server/src/tests/Repositories/DocumentRepositoryTest.php
changeset 26 72f51a9386ff
parent 19 eadaf0b8f02e
child 28 b0b56e0f8c7f
equal deleted inserted replaced
25:4ce76c9e7729 26:72f51a9386ff
    90     public function testAll() {
    90     public function testAll() {
    91         $expectedId = $this->corpusDocIdBaseUri.'crdo-ALA_738';
    91         $expectedId = $this->corpusDocIdBaseUri.'crdo-ALA_738';
    92         $returnedArray = [
    92         $returnedArray = [
    93             m::mock('resObj', function($mock) use (&$expectedId) {
    93             m::mock('resObj', function($mock) use (&$expectedId) {
    94                 $mock->uri = new EasyRdf\Resource($expectedId);
    94                 $mock->uri = new EasyRdf\Resource($expectedId);
       
    95                 $mock->doc = new EasyRdf\Resource("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ALA_738");
       
    96                 $mock->title = new EasyRdf\Literal("Atlas Linguistique et ethnographique de l'Alsace - Enquetes sur la conscience linguistique - ALA_738", null, "fr");
    95             }),
    97             }),
    96         ];
    98         ];
    97 
    99 
    98         $sparqlClientMock = m::mock('CorpusParole\Libraries\Sparql\SparqlClient');
   100         $sparqlClientMock = m::mock('CorpusParole\Libraries\Sparql\SparqlClient');
    99         $sparqlClientMock->shouldReceive('query')->andReturn($returnedArray);
   101         $sparqlClientMock->shouldReceive('query')->andReturn($returnedArray);
   106         $resDoc = $res[0];
   108         $resDoc = $res[0];
   107 
   109 
   108         $this->assertInstanceOf(Document::class, $resDoc, "Res doc must be a Document");
   110         $this->assertInstanceOf(Document::class, $resDoc, "Res doc must be a Document");
   109         $this->assertEquals('crdo-ALA_738', $resDoc->getId(), "id must be crdo...");
   111         $this->assertEquals('crdo-ALA_738', $resDoc->getId(), "id must be crdo...");
   110         $this->assertEquals($expectedId, $resDoc->getUri(), 'url must be ...');
   112         $this->assertEquals($expectedId, $resDoc->getUri(), 'url must be ...');
   111         $this->assertNull($resDoc->getGraph(), 'Graph must be null');
   113         $this->assertNotNull($resDoc->getGraph(), 'Graph must be not null');
   112     }
   114     }
   113 
   115 
   114     public function testGet() {
   116     public function testGet() {
   115 
   117 
   116         $expectedId = $this->corpusDocIdBaseUri.'crdo-ALA_738';
   118         $expectedId = $this->corpusDocIdBaseUri.'crdo-ALA_738';