server/src/tests/Controllers/DocumentListControllerTest.php
changeset 537 d2e6ee099125
parent 326 226d5b17a119
equal deleted inserted replaced
536:b64c8c35c67d 537:d2e6ee099125
     4 use Mockery as m;
     4 use Mockery as m;
     5 use Illuminate\Pagination\LengthAwarePaginator;
     5 use Illuminate\Pagination\LengthAwarePaginator;
     6 use CorpusParole\Models\Document;
     6 use CorpusParole\Models\Document;
     7 
     7 
     8 /**
     8 /**
     9  *
     9  * TODO: route has been deleted
    10  */
    10  */
    11 class DocumentListControllerTest extends TestCase {
    11 class DocumentListControllerTest extends TestCase {
    12 
    12 
    13     const GET_DOC = <<<EOT
    13     const GET_DOC = <<<EOT
    14     @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    14     @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
   101         m::close();
   101         m::close();
   102         parent::tearDown();
   102         parent::tearDown();
   103     }
   103     }
   104 
   104 
   105     public function testIndex() {
   105     public function testIndex() {
   106         $this->documentRepository
   106         // $this->documentRepository
   107             ->shouldReceive('paginate')
   107         //     ->shouldReceive('paginate')
   108             ->once()
   108         //     ->once()
   109             ->andReturn(
   109         //     ->andReturn(
   110                 new LengthAwarePaginator([], 0, 10, 1, [
   110         //         new LengthAwarePaginator([], 0, 10, 1, [
   111                     'path' => '',
   111         //             'path' => '',
   112                     'pageName' => config('corpusparole.pagination_page_param'),
   112         //             'pageName' => config('corpusparole.pagination_page_param'),
   113                 ]));
   113         //         ]));
   114 
   114 
   115         $response = $this->call('GET', '/bo/docs');
   115         // $response = $this->call('GET', '/bo/docs');
   116 
   116 
   117         $this->assertResponseOk($response);
   117         // $response
   118         $this->assertViewHas('docs');
   118         //     ->assertStatus(200)
       
   119         //     ->assertViewHas('docs');
   119     }
   120     }
   120 
   121 
   121     public function testShow() {
   122     // public function testShow() {
   122         $res_doc = new EasyRdf\Graph('http://corpusdelaparole.huma-num.fr/corpus/res/crdo-BOD092_SOUND',DocumentListControllerTest::GET_DOC);
   123     //     $res_doc = new EasyRdf\Graph('http://corpusdelaparole.huma-num.fr/corpus/res/crdo-BOD092_SOUND',DocumentListControllerTest::GET_DOC);
   123         $this->documentRepository
   124     //     $this->documentRepository
   124             ->shouldReceive('get')
   125     //         ->shouldReceive('get')
   125             ->once()
   126     //         ->once()
   126             ->andReturn(new Document('http://corpusdelaparole.huma-num.fr/corpus/res/crdo-BOD092_SOUND', $res_doc));
   127     //         ->andReturn(new Document('http://corpusdelaparole.huma-num.fr/corpus/res/crdo-BOD092_SOUND', $res_doc));
   127 
   128 
   128         $response = $this->visit('/bo/docs/crdo-BOD092_SOUND');
   129     //     $response = $this->visit('/bo/docs/crdo-BOD092_SOUND');
   129 
   130 
   130     }
   131     // }
   131 }
   132 }