diff -r 34ffc04cef62 -r e60c55988ed4 server/src/tests/libraries/Mappers/CocoonSoundRdfMapperTest.php --- a/server/src/tests/libraries/Mappers/CocoonSoundRdfMapperTest.php Wed Feb 03 18:34:44 2016 +0100 +++ b/server/src/tests/libraries/Mappers/CocoonSoundRdfMapperTest.php Fri Feb 05 15:08:46 2016 +0100 @@ -268,6 +268,51 @@ } + public function testRightsWebResourceIdentity() { + $properties = [ + "http://purl.org/dc/elements/1.1/rights", + 'http://purl.org/dc/terms/license', + ]; + + $webResourceList = $this->resGraphes['BASE']->all('edm:WebResource', '^rdf:type'); + $sourceNode = $this->inputGraphes['BASE']->get('http://crdo.risc.cnrs.fr/schemas/Resource', '^rdf:type'); + + foreach ($webResourceList as $webResource) { + foreach ($properties as $prop) { + $outputValuesStr = []; + foreach($webResource->all($this->resGraphes['BASE']->resource($prop)) as $outputValue) { + array_push($outputValuesStr, strval($outputValue)); + } + $this->assertNotEmpty($outputValuesStr, "we must found some values to test $prop"); + foreach ($sourceNode->all($this->inputGraphes['BASE']->resource($prop)) as $value) { + $this->assertContains(strval($value), $outputValuesStr, "$prop not found in output graph"); + } + } + } + } + + public function testRightsWebResourceTrim() { + $properties = [ + 'http://purl.org/dc/terms/accessRights', + ]; + + $webResourceList = $this->resGraphes['BASE']->all('edm:WebResource', '^rdf:type'); + $sourceNode = $this->inputGraphes['BASE']->get('http://crdo.risc.cnrs.fr/schemas/Resource', '^rdf:type'); + + foreach ($webResourceList as $webResource) { + foreach ($properties as $prop) { + $outputValuesStr = []; + foreach($webResource->all($this->resGraphes['BASE']->resource($prop)) as $outputValue) { + array_push($outputValuesStr, strval($outputValue)); + } + $this->assertNotEmpty($outputValuesStr, "we must found some values to test $prop"); + foreach ($sourceNode->all($this->inputGraphes['BASE']->resource($prop)) as $value) { + $this->assertContains(trim(strval($value)), $outputValuesStr, "$prop not found in output graph"); + } + } + } + } + /** * Test one to one mapping *