server/src/tests/Repositories/DocumentRepositoryTest.php
changeset 122 b37fde30dd4a
parent 113 faff38055a07
child 129 4fca650b9b8a
equal deleted inserted replaced
121:08c99d286e7c 122:b37fde30dd4a
   107 
   107 
   108         $this->assertCount(1, $res, "Should have 1 doc in res");
   108         $this->assertCount(1, $res, "Should have 1 doc in res");
   109         $resDoc = $res[0];
   109         $resDoc = $res[0];
   110 
   110 
   111         $this->assertInstanceOf(Document::class, $resDoc, "Res doc must be a Document");
   111         $this->assertInstanceOf(Document::class, $resDoc, "Res doc must be a Document");
   112         $this->assertEquals('crdo-ALA_738', $resDoc->getId(), "id must be crdo...");
   112         $this->assertEquals('corpusparole:crdo-ALA_738', $resDoc->getId(), "id must be crdo...");
   113         $this->assertEquals($expectedId, $resDoc->getUri(), 'url must be ...');
   113         $this->assertEquals($expectedId, $resDoc->getUri(), 'url must be ...');
   114         $this->assertNotNull($resDoc->getGraph(), 'Graph must be not null');
   114         $this->assertNotNull($resDoc->getGraph(), 'Graph must be not null');
   115     }
   115     }
   116 
   116 
   117     public function testGet() {
   117     public function testGet() {
   125         $documentRepository = $this->app->make('CorpusParole\Repositories\RdfDocumentRepository', [$sparqlClientMock]);
   125         $documentRepository = $this->app->make('CorpusParole\Repositories\RdfDocumentRepository', [$sparqlClientMock]);
   126 
   126 
   127         $res = $documentRepository->get('crdo-ALA_738');
   127         $res = $documentRepository->get('crdo-ALA_738');
   128 
   128 
   129         $this->assertInstanceOf(Document::class, $res, "Result must be of type Document");
   129         $this->assertInstanceOf(Document::class, $res, "Result must be of type Document");
   130         $this->assertEquals('crdo-ALA_738', $res->getId(), 'id should be crdo-ALA_738' );
   130         $this->assertEquals('corpusparole:crdo-ALA_738', $res->getId(), 'id should be crdo-ALA_738' );
   131         $this->assertNotNull($res->getGraph(), "Graph shoul not be null");
   131         $this->assertNotNull($res->getGraph(), "Graph shoul not be null");
   132         $this->assertTrue(EasyRdf\Isomorphic::isomorphic($res->getGraph(), new EasyRdf\Graph($expectedId, DocumentRepositoryTest::TEST_DOC)));
   132         $this->assertTrue(EasyRdf\Isomorphic::isomorphic($res->getGraph(), new EasyRdf\Graph($expectedId, DocumentRepositoryTest::TEST_DOC)));
   133     }
   133     }
   134 
   134 
   135     public function testSave() {
   135     public function testSave() {