This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| assertActionUsesFormRequest( | |
| UsersController::class, // Controller | |
| 'update', // Method | |
| UserUpdateRequest::class); // Form Request | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function testSpying() | |
| { | |
| $spy = Mockery::spy(); | |
| $this->assertNull($spy->quix()); | |
| // assert behavior | |
| $spy->shouldHaveReceived('quix')->once(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected function setUp(): void | |
| { | |
| parent::setUp(); | |
| $this->subject = new UserUpdateRequest(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $mock = \Mockery::mock(); | |
| $mock->shouldReceive('info') // method name | |
| ->once() | |
| ->with('video.watched', [$video->id]); | |
| Log::swap($mock); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // What is the simplest mock you can create? | |
| class ExampleTest extends \PHPUnit\Framework\TestCase | |
| { | |
| public function testMocking() | |
| { | |
| $mock = \Mockery::mock(); | |
| $mock->shouldReceive('foo') // method name | |
| ->with('bar') // arg | |
| ->andReturn('baz'); // arg | |
| $this->assertEquals('baz', $mock->foo('bar')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PHPUnit extends TestCase | |
| { | |
| public function testAssertions() | |
| { | |
| $this->assertTrue(true); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function() { | |
| return $this; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FAILURES! | |
| Tests: 1, Assertions: 4, Failures: 1. | |
| PHPUnit\Framework\ExpectationFailedException : Failed asserting that '<!doctype html>\n | |
| <html lang="en">\n | |
| <head>\n | |
| <meta charset="utf-8">\n | |
| <meta name="viewport" content="width=device-width, initial-scale=1">\n | |
| \n | |
| <!-- CSRF Token -->\n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <ruleset name="PHP_CodeSniffer"> | |
| <description>The coding standard for this project.</description> | |
| <rule ref="PSR2"/> | |
| <file>app</file> | |
| <file>bootstrap</file> | |
| <file>config</file> | |
| <file>database</file> | |
| <file>resources</file> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Tests\Feature; | |
| use Tests\TestCase; | |
| use Illuminate\Foundation\Testing\WithFaker; | |
| use Illuminate\Foundation\Testing\RefreshDatabase; | |
| use App\User; | |
| class ExampleTest extends TestCase |