Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use Way\Tests\Factory;
- //...
- class ProfessionsControllerTest extends \TestCase {
- private $mock;
- public function setUp() {
- parent::setUp();
- $this->mock = \Mockery::mock('Evalua\Heva\Repositories\ProfessionRepositoryInterface');
- $this->app->instance('Evalua\Heva\Repositories\ProfessionRepositoryInterface', $this->mock);
- }
- public function tearDown() {
- \Mockery::close();
- }
- public function testShouldCallFindAndReturnAProfessionWhenGettingAProfessionById() {
- $profession = Factory::attributesFor('Evalua\Heva\Models\Profession');
- $this->mock->shouldReceive('find')
- ->with('1')
- ->once()
- ->andReturn($profession);
- $response = $this->call('GET', 'professions/1');
- $content = $response->getContent();
- $this->assertResponseStatus(HttpStatusCodes::OK);
- $this->assertJson($content);
- $this->assertInternalType('object', json_decode($content));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement