This file contains 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 | |
test('user authorization', function () { | |
$auth = Mockery::mock(Auth::class); | |
$auth->shouldReceive('login'); | |
$auth->shouldReceive('authorize'); | |
$user = new UserRepository($auth); | |
expect($user->getAuthorized()) | |
->not->toBeEmpty(); |
This file contains 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 | |
test('calculation', function () { | |
$result = 2 * 4; | |
expect($result) | |
->toBeInt() // Assert that the result is an integer | |
->toBe(8) // Assert that the result value is 8 | |
->not->toBeJson() // Using "not" modifier, asserting that the value isn't JSON | |
->not->toBe(5); // Another usage example of "not" modifier |
This file contains 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 | |
beforeAll(function () { | |
// Executes first, before any of tests are run | |
// Eg. can be used to set up a testing database | |
}); | |
beforeEach(function () { | |
$this->bookRepository = new BookRepository(); | |
}); |
NewerOlder