131 $this->assertInstanceOf('EasyRdf\Literal', $identifier, "identifier value must be a literal"); |
131 $this->assertInstanceOf('EasyRdf\Literal', $identifier, "identifier value must be a literal"); |
132 $this->assertEquals(CocoonTextRdfMapperTest::TEST_INPUT_ID, $identifier->getValue(), "Value must be equals to ".CocoonTextRdfMapperTest::TEST_INPUT_ID); |
132 $this->assertEquals(CocoonTextRdfMapperTest::TEST_INPUT_ID, $identifier->getValue(), "Value must be equals to ".CocoonTextRdfMapperTest::TEST_INPUT_ID); |
133 |
133 |
134 } |
134 } |
135 |
135 |
|
136 public function testRightsWebResourceIdentity() { |
|
137 $properties = [ |
|
138 "http://purl.org/dc/elements/1.1/rights", |
|
139 'http://purl.org/dc/terms/license', |
|
140 ]; |
|
141 |
|
142 $webResourceList = $this->resGraphes['BASE']->all('edm:WebResource', '^rdf:type'); |
|
143 $sourceNode = $this->inputGraphes['BASE']->get('http://crdo.risc.cnrs.fr/schemas/Resource', '^rdf:type'); |
|
144 |
|
145 foreach ($webResourceList as $webResource) { |
|
146 foreach ($properties as $prop) { |
|
147 $outputValuesStr = []; |
|
148 foreach($webResource->all($this->resGraphes['BASE']->resource($prop)) as $outputValue) { |
|
149 array_push($outputValuesStr, strval($outputValue)); |
|
150 } |
|
151 $this->assertNotEmpty($outputValuesStr, "we must found some values to test $prop"); |
|
152 foreach ($sourceNode->all($this->inputGraphes['BASE']->resource($prop)) as $value) { |
|
153 $this->assertContains(strval($value), $outputValuesStr, "$prop not found in output graph"); |
|
154 } |
|
155 } |
|
156 } |
|
157 } |
|
158 |
|
159 public function testRightsWebResourceTrim() { |
|
160 $properties = [ |
|
161 'http://purl.org/dc/terms/accessRights', |
|
162 ]; |
|
163 |
|
164 $webResourceList = $this->resGraphes['BASE']->all('edm:WebResource', '^rdf:type'); |
|
165 $sourceNode = $this->inputGraphes['BASE']->get('http://crdo.risc.cnrs.fr/schemas/Resource', '^rdf:type'); |
|
166 |
|
167 foreach ($webResourceList as $webResource) { |
|
168 foreach ($properties as $prop) { |
|
169 $outputValuesStr = []; |
|
170 foreach($webResource->all($this->resGraphes['BASE']->resource($prop)) as $outputValue) { |
|
171 array_push($outputValuesStr, strval($outputValue)); |
|
172 } |
|
173 $this->assertNotEmpty($outputValuesStr, "we must found some values to test $prop"); |
|
174 foreach ($sourceNode->all($this->inputGraphes['BASE']->resource($prop)) as $value) { |
|
175 $this->assertContains(trim(strval($value)), $outputValuesStr, "$prop not found in output graph"); |
|
176 } |
|
177 } |
|
178 } |
|
179 } |
|
180 |
|
181 |
136 /** |
182 /** |
137 * Test providedCHO uri. |
183 * Test providedCHO uri. |
138 * |
184 * |
139 * @return void |
185 * @return void |
140 */ |
186 */ |