diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php
new file mode 100644
index 000000000000..af2aeb95c47a
--- /dev/null
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php
@@ -0,0 +1,100 @@
+entity, $this->fieldName, array('type' => $formatter));
+ $rendered = "
" . drupal_render($build) . '
';
+ $graph = new \EasyRdf_Graph($this->uri, $rendered, 'rdfa');
+
+ $expected_value = array(
+ 'type' => $object_type,
+ 'value' => $value,
+ );
+ $this->assertTrue($graph->hasProperty($this->uri, $property, $expected_value), "Formatter $formatter exposes data correctly for {$this->fieldType} fields.");
+ }
+
+ /**
+ * Creates the field for testing.
+ */
+ protected function createTestField() {
+ entity_create('field_entity', array(
+ 'field_name' => $this->fieldName,
+ 'type' => $this->fieldType,
+ ))->save();
+ entity_create('field_instance', array(
+ 'entity_type' => 'entity_test',
+ 'field_name' => $this->fieldName,
+ 'bundle' => 'entity_test',
+ ))->save();
+ }
+
+ /**
+ * Gets the absolute URI of an entity.
+ *
+ * @param \Drupal\Core\Entity\EntityNG $entity
+ * The entity for which to generate the URI.
+ *
+ * @return string
+ * The absolute URI.
+ */
+ protected function getAbsoluteUri($entity) {
+ $uri_info = $entity->uri();
+ return url($uri_info['path'], array('absolute' => TRUE));
+ }
+}