--- a/server/src/tests/libraries/Mappers/CocoonSoundRdfMapperTest.php Mon Mar 21 14:04:19 2016 +0100
+++ b/server/src/tests/libraries/Mappers/CocoonSoundRdfMapperTest.php Fri Mar 25 17:03:45 2016 +0100
@@ -111,7 +111,6 @@
];
const TEST_INPUT_ID = "crdo-ESLO1_ENT_019";
- const TEST_GRAPH_URI = "http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ESLO1_ENT_019";
const TEST_CHO_URI = "http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ESLO1_ENT_019";
@@ -126,6 +125,8 @@
public function setUp() {
parent::setUp();
+ $this->testGraphUri = config('corpusparole.corpus_doc_id_base_uri').CocoonSoundRdfMapperTest::TEST_INPUT_ID;
+
foreach(CocoonSoundRdfMapperTest::TEST_INPUT_DOCS as $key => $inputDoc) {
$this->inputGraphes[$key] = new Graph("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ESLO1_ENT_019", $inputDoc);
$this->mappers[$key] = new CocoonSoundRdfMapper($this->inputGraphes[$key]);
@@ -159,7 +160,7 @@
//echo var_export($this->resGraphes['BASE']->toRdfPhp());
$this->assertNotNull($this->resGraphes['BASE']);
- $this->assertEquals(CocoonSoundRdfMapperTest::TEST_GRAPH_URI, $this->resGraphes['BASE']->getUri(), "URIS must be translated");
+ $this->assertEquals($this->testGraphUri, $this->resGraphes['BASE']->getUri(), "URIS must be translated");
}
/**
@@ -172,7 +173,7 @@
$resources = $this->resGraphes['BASE']->allOfType('ore:Aggregation');
$this->assertCount(1, $resources, "Must found only one resources of type ore:Aggregation");
- $this->assertEquals(CocoonSoundRdfMapperTest::TEST_GRAPH_URI,$resources[0]);
+ $this->assertEquals($this->testGraphUri,$resources[0]);
}
/**
@@ -182,14 +183,14 @@
*/
public function testProviders() {
- $providers = $this->resGraphes['BASE']->all(CocoonSoundRdfMapperTest::TEST_GRAPH_URI,'edm:provider');
+ $providers = $this->resGraphes['BASE']->all($this->testGraphUri,'edm:provider');
$this->assertCount(1,$providers, "one and only one edm provider");
$this->assertTrue($providers[0] instanceof Literal);
$this->assertEquals('Corpus de la Parole', $providers[0]->getValue(), 'provider must be Corpus de la Parole');
$this->assertEquals('fr', $providers[0]->getLang(), 'provider must be in french');
- $dataProviders = $this->resGraphes['BASE']->all(CocoonSoundRdfMapperTest::TEST_GRAPH_URI,'edm:dataProvider');
+ $dataProviders = $this->resGraphes['BASE']->all($this->testGraphUri,'edm:dataProvider');
$this->assertCount(1,$dataProviders, "one and only one edm data provider");
//TODO: to change after viaf resolution
@@ -205,13 +206,13 @@
*/
public function testIsShown() {
- $isShownAts = $this->resGraphes['BASE']->all(CocoonSoundRdfMapperTest::TEST_GRAPH_URI, 'edm:isShownAt');
+ $isShownAts = $this->resGraphes['BASE']->all($this->testGraphUri, 'edm:isShownAt');
$this->assertCount(1, $isShownAts, "One edm:isShownAt");
$this->assertInstanceOf("EasyRdf\Resource", $isShownAts[0]);
$this->assertEquals("http://corpusdelaparole.huma-num.fr/corpus-app#/detail/crdo-ESLO1_ENT_019", $isShownAts[0]);
- $isShownBys = $this->resGraphes['BASE']->all(CocoonSoundRdfMapperTest::TEST_GRAPH_URI, 'edm:isShownBy');
+ $isShownBys = $this->resGraphes['BASE']->all($this->testGraphUri, 'edm:isShownBy');
$this->assertCount(1, $isShownBys, "One edm:isShownBy");
$this->assertInstanceOf("EasyRdf\Resource", $isShownBys[0]);
@@ -225,7 +226,7 @@
* @return void
*/
public function testRights() {
- $rightsNodes = $this->resGraphes['BASE']->all(CocoonSoundRdfMapperTest::TEST_GRAPH_URI, 'edm:rights');
+ $rightsNodes = $this->resGraphes['BASE']->all($this->testGraphUri, 'edm:rights');
$this->assertCount(1, $rightsNodes, "One edm:right");
@@ -502,7 +503,7 @@
$this->assertCount(3, $resources, "Must found three webresource");
- $aggregation = $this->resGraphes['BASE']->resource(CocoonSoundRdfMapperTest::TEST_GRAPH_URI);
+ $aggregation = $this->resGraphes['BASE']->resource($this->testGraphUri);
foreach ($resources as $wres) {
$mimetypes = $wres->all($this->resGraphes['BASE']->resource('http://purl.org/dc/elements/1.1/format'));
@@ -569,7 +570,7 @@
$outputs = $this->mappers['BASE']->getOutputGraphes();
$this->assertCount(3, $outputs, "Must have 3 graphes as output");
foreach($outputs as $url => $outputGraph) {
- if($outputGraph->getUri() == 'http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ESLO1_ENT_019') {
+ if($outputGraph->getUri() == config('corpusparole.corpus_doc_id_base_uri').'crdo-ESLO1_ENT_019') {
continue;
}
$this->assertContains($outputGraph->getUri(), ['http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LANGUESDEFRANCE', 'http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ESLO1']);