Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2.  
  3. use Way\Tests\Factory;
  4. //...
  5. class ProfessionsControllerTest extends \TestCase {
  6.    
  7.     private $mock;
  8.  
  9.     public function setUp() {
  10.         parent::setUp();
  11.         $this->mock = \Mockery::mock('Evalua\Heva\Repositories\ProfessionRepositoryInterface');
  12.         $this->app->instance('Evalua\Heva\Repositories\ProfessionRepositoryInterface', $this->mock);
  13.     }
  14.  
  15.     public function tearDown() {
  16.         \Mockery::close();
  17.     }
  18.  
  19.     public function testShouldCallFindAndReturnAProfessionWhenGettingAProfessionById() {
  20.         $profession = Factory::attributesFor('Evalua\Heva\Models\Profession');
  21.         $this->mock->shouldReceive('find')
  22.             ->with('1')
  23.             ->once()
  24.             ->andReturn($profession);
  25.  
  26.         $response = $this->call('GET', 'professions/1');
  27.         $content = $response->getContent();
  28.  
  29.         $this->assertResponseStatus(HttpStatusCodes::OK);
  30.         $this->assertJson($content);
  31.         $this->assertInternalType('object', json_decode($content));
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement