Permalink
Browse files

Make sure revoptions are set in the array driver as well

  • Loading branch information...
1 parent 6c8317f commit 3a8fbbbb62fc44b06081d58566466f00bdcc1a10 @flack committed Dec 17, 2012
@@ -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']);
}
@@ -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());
+ }
}
@@ -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());
+ }
}
@@ -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"/>

0 comments on commit 3a8fbbb

Please sign in to comment.