Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make sure revoptions are set in the array driver as well

  • Loading branch information...
commit 3a8fbbbb62fc44b06081d58566466f00bdcc1a10 1 parent 6c8317f
@flack authored
View
7 src/Midgard/CreatePHP/Metadata/RdfDriverArray.php
@@ -102,6 +102,13 @@ public function loadType($className, RdfMapperInterface $mapper, RdfTypeFactory
$type->setVocabulary($prefix, $uri);
}
}
+
+ if (isset($definition['rev'])) {
+ foreach ($definition['rev'] as $rev) {
+ $type->addRev((string) $rev);
+ }
+ }
+
if (isset($definition['typeof'])) {
$type->setRdfType($definition['typeof']);
}
View
18 tests/Test/Midgard/CreatePHP/Metadata/RdfDriverArrayTest.php
@@ -22,6 +22,7 @@ public function setUp()
"dcterms" => "http://purl.org/dc/terms/",
),
"typeof" => "sioc:Post",
+ "rev" => array("dcterms:partOf"),
"config" => array(
"test" => "testvalue",
),
@@ -100,4 +101,21 @@ public function testGetAllNames()
);
$this->assertEquals($types, $map);
}
+
+ /**
+ * Gets the names of all revs known to this type.
+ *
+ * @return array The names of all revs known to this type.
+ */
+ public function testGetRevOptions()
+ {
+ $mapper = $this->getMock('Midgard\\CreatePHP\\RdfMapperInterface');
+ $typeFactory = $this->getMockBuilder('Midgard\\CreatePHP\\Metadata\\RdfTypeFactory')->disableOriginalConstructor()->getMock();
+ $type = $this->driver->loadType('Test\\Midgard\\CreatePHP\\Model', $mapper, $typeFactory);
+
+ $revs = array(
+ 'dcterms:partOf' => 'dcterms:partOf',
+ );
+ $this->assertEquals($revs, $type->getRevOptions());
+ }
}
View
18 tests/Test/Midgard/CreatePHP/Metadata/RdfDriverXmlTest.php
@@ -59,4 +59,22 @@ public function testGetAllNames()
);
$this->assertEquals($types, $map);
}
+
+
+ /**
+ * Gets the names of all revs known to this type.
+ *
+ * @return array The names of all revs known to this type.
+ */
+ public function testGetRevOptions()
+ {
+ $mapper = $this->getMock('Midgard\\CreatePHP\\RdfMapperInterface');
+ $typeFactory = $this->getMockBuilder('Midgard\\CreatePHP\\Metadata\\RdfTypeFactory')->disableOriginalConstructor()->getMock();
+ $type = $this->driver->loadType('Test\\Midgard\\CreatePHP\\Model', $mapper, $typeFactory);
+
+ $revs = array(
+ 'dcterms:partOf' => 'dcterms:partOf',
+ );
+ $this->assertEquals($revs, $type->getRevOptions());
+ }
}
View
1  tests/Test/Midgard/CreatePHP/Metadata/rdf/Test.Midgard.CreatePHP.Model.xml
@@ -3,6 +3,7 @@
xmlns:dcterms="http://purl.org/dc/terms/"
typeof="sioc:Post"
>
+ <rev>dcterms:partOf</rev>
<config key="test" value="testvalue" />
<children>
<property property="dcterms:title" identifier="title" tag-name="h2"/>
Please sign in to comment.
Something went wrong with that request. Please try again.