Created
October 13, 2012 13:42
-
-
Save jamierumbelow/3884671 to your computer and use it in GitHub Desktop.
Testing for Laravel 4
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 App\Tests\Unit; | |
use App\Models\User as User; | |
class UserControllerTest extends \PHPUnit_Framework_TestCase | |
{ | |
public function testMostPopular() | |
{ | |
User::shouldReceive('getMostPopular')->andReturn('userData'); | |
View::shouldReceive('make')->with('users.popular', 'userData'); | |
(new UserController())->showMostPopular(); | |
} | |
} |
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 App\Tests\Unit; | |
use App\Models\User as User; | |
class UserTest extends \PHPUnit_Framework_TestCase | |
{ | |
public function testUserIsValidatedAppropriately() | |
{ | |
$user = new User(); | |
$user->assertValidated('email', 'valid_email'); // whatever | |
$user->assertValidated('password', 'min_length', 10); // whatever | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment