server/src/tests/libraries/Mappers/CocoonTextRdfMapperTest.php
changeset 19 eadaf0b8f02e
parent 18 f2a40bbc27f6
child 111 af85c436048f
--- a/server/src/tests/libraries/Mappers/CocoonTextRdfMapperTest.php	Tue Nov 17 13:11:55 2015 +0100
+++ b/server/src/tests/libraries/Mappers/CocoonTextRdfMapperTest.php	Fri Nov 27 17:59:36 2015 +0100
@@ -127,7 +127,7 @@
     }
 
     /**
-     * Test taht the returned graph does not have a http://purl.org/dc/dcmitype/Sound type
+     * Test that the returned graph does not have a http://purl.org/dc/dcmitype/Sound type
      *
      * @return void
      */
@@ -137,19 +137,17 @@
 
         $this->assertNotNull($providedCHO);
 
-        $this->assertEmpty($providedCHO->all($this->resGraphes['BASE']->resource('http://purl.org/dc/elements/1.1/type'), 'resource'), 'Should not find dc element:type value as resource');
-        $this->assertcount(2, $providedCHO->all($this->resGraphes['BASE']->resource('http://purl.org/dc/elements/1.1/type')), 'but should find 2 literals');
-
-        $expResMap = [
-            'primary_text' => 'http://www.language-archives.org/OLAC/1.1/linguistic-type',
-            'narrative' => 'http://www.language-archives.org/OLAC/1.1/discourse-type'
-        ];
+        $this->assertcount(3, $providedCHO->all($this->resGraphes['BASE']->resource('http://purl.org/dc/elements/1.1/type')), 'but should find 2 literals');
 
         $dcTypeList = $providedCHO->all($this->resGraphes['BASE']->resource('http://purl.org/dc/elements/1.1/type'));
         foreach ($dcTypeList as $dcType) {
-            $this->assertInstanceOf('EasyRdf\Literal', $dcType, "dc type must be a literal");
-            $this->assertArrayHasKey($dcType->getValue(),$expResMap, 'Value must be in expected result Map');
-            $this->assertEquals($expResMap[$dcType->getValue()], $dcType->getDatatypeUri());
+            $this->assertThat(
+                $dcType,
+                $this->logicalXor(
+                    $this->isInstanceOf(EasyRdf\Literal::class),
+                    $this->isInstanceOf(EasyRdf\Resource::class)
+                )
+            );
         }
     }