server/src/tests/Controllers/DocumentListControllerTest.php
changeset 2 00e2916104fe
child 4 f55970e41793
equal deleted inserted replaced
1:01a844d292ac 2:00e2916104fe
       
     1 <?php
       
     2 
       
     3 use CorpusParole\Repositories\DocumentRepository;
       
     4 use Mockery as m;
       
     5 
       
     6 /**
       
     7  *
       
     8  */
       
     9 class DocumentListControllerTest extends TestCase {
       
    10 
       
    11     private $documentRepository;
       
    12 
       
    13     public function setUp() {
       
    14 
       
    15         parent::setup();
       
    16 
       
    17         // create a mock of the post repository interface and inject it into the
       
    18         // IoC container
       
    19         $this->documentRepository = m::mock('CorpusParole\Repositories\DocumentRepository');
       
    20         $this->app->instance('CorpusParole\Repositories\DocumentRepository', $this->documentRepository);
       
    21     }
       
    22 
       
    23     public function tearDown() {
       
    24         m::close();
       
    25         parent::tearDown();
       
    26     }
       
    27 
       
    28     public function testIndex() {
       
    29         $this->documentRepository->shouldReceive('all')->once()->andReturn(array());
       
    30 
       
    31         $response = $this->call('GET', '/bo/docs');
       
    32 
       
    33         $this->assertResponseOk($response);
       
    34         $this->assertViewHas('docs');
       
    35     }
       
    36 }