server/src/tests/Repositories/DocumentRepositoryTest.php
changeset 143 023b6d467566
parent 129 4fca650b9b8a
child 168 17f10b56c079
--- a/server/src/tests/Repositories/DocumentRepositoryTest.php	Mon Mar 21 14:04:19 2016 +0100
+++ b/server/src/tests/Repositories/DocumentRepositoryTest.php	Fri Mar 25 17:03:45 2016 +0100
@@ -22,7 +22,7 @@
         owl:sameAs <http://sws.geonames.org/3038033/> ;
         <http://www.w3.org/2004/02/skos/core#note> "northlimit=47.431892250000033; southlimit=49.053971250000046;westlimit=6.846186050000028; eastlimit=8.232571550000074;"^^<http://purl.org/dc/terms/Box> , "FR"^^<http://purl.org/dc/terms/ISO3166> , "France, Alsace"@fr .
 
-    <http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ALA_738> a <http://www.openarchives.org/ore/terms/Aggregation> ;
+    <%1\$scrdo-ALA_738> a <http://www.openarchives.org/ore/terms/Aggregation> ;
         <http://www.europeana.eu/schemas/edm/aggregatedCHO> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ALA_738> ;
         <http://www.europeana.eu/schemas/edm/dataProvider> "Atlas linguistiques, cultures et parlers régionaux de France" ;
         <http://www.europeana.eu/schemas/edm/hasView> <http://cocoon.huma-num.fr/data/ala/ALA_738.mp3> , <http://cocoon.huma-num.fr/data/ala/ALA_738_22km.wav> ;
@@ -78,7 +78,7 @@
 
     public function setUp() {
         parent::setUp();
-        $this->graph = new EasyRdf\Graph("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ALA_738", DocumentRepositoryTest::TEST_DOC);
+        $this->graph = new EasyRdf\Graph(config('corpusparole.corpus_doc_id_base_uri')."crdo-ALA_738", sprintf(DocumentRepositoryTest::TEST_DOC, config('corpusparole.corpus_doc_id_base_uri')));
         $this->corpusDocIdBaseUri = config('corpusparole.corpus_doc_id_base_uri');
     }
 
@@ -109,7 +109,7 @@
         $resDoc = $res[0];
 
         $this->assertInstanceOf(Document::class, $resDoc, "Res doc must be a Document");
-        $this->assertEquals('corpusparole:crdo-ALA_738', $resDoc->getId(), "id must be crdo...");
+        $this->assertEquals(config('corpusparole.corpus_id_scheme').'crdo-ALA_738', $resDoc->getId(), "id must be crdo...");
         $this->assertEquals($expectedId, $resDoc->getUri(), 'url must be ...');
         $this->assertNotNull($resDoc->getGraph(), 'Graph must be not null');
     }
@@ -117,7 +117,7 @@
     public function testGet() {
 
         $expectedId = $this->corpusDocIdBaseUri.'crdo-ALA_738';
-        $returnedGraph = new EasyRdf\Graph($expectedId, DocumentRepositoryTest::TEST_DOC);
+        $returnedGraph = new EasyRdf\Graph($expectedId, sprintf(DocumentRepositoryTest::TEST_DOC, config('corpusparole.corpus_doc_id_base_uri')));
 
         $sparqlClientMock = m::mock('CorpusParole\Libraries\Sparql\SparqlClient');
         $sparqlClientMock->shouldReceive('query')->with(\Hamcrest\Text\StringContains::containsString($expectedId))
@@ -127,9 +127,9 @@
         $res = $documentRepository->get('crdo-ALA_738');
 
         $this->assertInstanceOf(Document::class, $res, "Result must be of type Document");
-        $this->assertEquals('corpusparole:crdo-ALA_738', $res->getId(), 'id should be crdo-ALA_738' );
+        $this->assertEquals(config('corpusparole.corpus_id_scheme').'crdo-ALA_738', $res->getId(), 'id should be crdo-ALA_738' );
         $this->assertNotNull($res->getGraph(), "Graph shoul not be null");
-        $this->assertTrue(EasyRdf\Isomorphic::isomorphic($res->getGraph(), new EasyRdf\Graph($expectedId, DocumentRepositoryTest::TEST_DOC)));
+        $this->assertTrue(EasyRdf\Isomorphic::isomorphic($res->getGraph(), new EasyRdf\Graph($expectedId, sprintf(DocumentRepositoryTest::TEST_DOC, config('corpusparole.corpus_doc_id_base_uri')))));
     }
 
     public function testSave() {
@@ -142,7 +142,7 @@
         $documentRepository = $this->app->make('CorpusParole\Repositories\RdfDocumentRepository', [$sparqlClientMock]);
 
 
-        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ALA_738", $this->graph);
+        $doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-ALA_738", $this->graph);
         $doc->updateDiscourseTypes(['oratory','drama','narrative']);
 
         $res = $documentRepository->save($doc);