Commit 79aa8a63 authored by Dries's avatar Dries

Issue #1869600 by tim.plunkett: Fixed broken head.

parent b4655c58
......@@ -22,6 +22,27 @@ class FileFieldAttributesTest extends FileFieldTestBase {
*/
public static $modules = array('rdf', 'file');
/**
* The name of the file field used in the test.
*
* @var string
*/
protected $fieldName;
/**
* The file object used in the test.
*
* @var \Drupal\file\FileInterface
*/
protected $file;
/**
* The node object used in the test.
*
* @var \Drupal\node\NodeInterface
*/
protected $node;
public static function getInfo() {
return array(
'name' => 'RDFa markup for files',
......@@ -63,11 +84,8 @@ public function setUp() {
* when displayed as a teaser.
*/
function testNodeTeaser() {
$node = $this->node;
$node_file = $this->file;
// Render the teaser.
$node_render_array = entity_view_multiple(array($node), 'teaser');
$node_render_array = entity_view_multiple(array($this->node), 'teaser');
$html = drupal_render($node_render_array);
// Parses front page where the node is displayed in its teaser form.
......@@ -76,8 +94,8 @@ function testNodeTeaser() {
$base_uri = url('<front>', array('absolute' => TRUE));
$parser->parse($graph, $html, 'rdfa', $base_uri);
$node_uri = url('node/' . $node->nid, array('absolute' => TRUE));
$file_uri = file_create_url($node_file->getFileUri());
$node_uri = url('node/' . $this->node->id(), array('absolute' => TRUE));
$file_uri = file_create_url($this->file->getFileUri());
// Node relation to attached file.
$expected_value = array(
......@@ -87,4 +105,5 @@ function testNodeTeaser() {
$this->assertTrue($graph->hasProperty($node_uri, 'http://www.w3.org/2000/01/rdf-schema#seeAlso', $expected_value), 'Node to file relation found in RDF output (rdfs:seeAlso).');
$this->drupalGet('node');
}
}
......@@ -9,7 +9,6 @@
use Drupal\Core\Language\Language;
use Drupal\image\Tests\ImageFieldTestBase;
use Drupal\rdf\Tests\RdfTestHelper;
/**
* Tests RDFa markup generation for image fields.
......@@ -23,6 +22,27 @@ class ImageFieldAttributesTest extends ImageFieldTestBase {
*/
public static $modules = array('rdf', 'image');
/**
* The name of the image field used in the test.
*
* @var string
*/
protected $fieldName;
/**
* The file object used in the test.
*
* @var \Drupal\file\FileInterface
*/
protected $file;
/**
* The node object used in the test.
*
* @var \Drupal\node\NodeInterface
*/
protected $node;
public static function getInfo() {
return array(
'name' => 'RDFa markup for imagefield',
......@@ -60,9 +80,6 @@ public function setUp() {
* Tests that image fields in teasers have correct resources.
*/
function testNodeTeaser() {
$node = $this->node;
$node_file = $this->file;
// Set the display options for the teaser.
$display_options = array(
'type' => 'image',
......@@ -73,7 +90,7 @@ function testNodeTeaser() {
->save();
// Render the teaser.
$node_render_array = node_view($node, 'teaser');
$node_render_array = node_view($this->node, 'teaser');
$html = drupal_render($node_render_array);
// Parse the teaser.
......@@ -83,8 +100,8 @@ function testNodeTeaser() {
$parser->parse($graph, $html, 'rdfa', $base_uri);
// Construct the node and image URIs for testing.
$node_uri = url('node/' . $node->nid, array('absolute' => TRUE));
$image_uri = image_style_url('medium', $node_file->getFileUri());
$node_uri = url('node/' . $this->node->id(), array('absolute' => TRUE));
$image_uri = image_style_url('medium', $this->file->getFileUri());
// Test relations from node to image.
$expected_value = array(
......
......@@ -7,8 +7,6 @@
namespace Drupal\rdf\Tests;
use Drupal\Core\Language\Language;
use Drupal\rdf\Tests\RdfTestHelper;
use Drupal\taxonomy\Tests\TaxonomyTestBase;
/**
......@@ -23,6 +21,20 @@ class TaxonomyTermFieldAttributesTest extends TaxonomyTestBase {
*/
public static $modules = array('rdf', 'field_test', 'file', 'image');
/**
* The name of the taxonomy term reference field used in the test.
*
* @var string
*/
protected $fieldName;
/**
* The vocabulary object used in the test.
*
* @var \Drupal\taxonomy\VocabularyInterface
*/
protected $vocabulary;
public static function getInfo() {
return array(
'name' => 'RDFa markup for taxonomy term fields',
......@@ -141,7 +153,7 @@ function testNodeTeaser() {
* @todo Move this to TaxonomyTestBase, like the other field modules.
*/
protected function createTaxonomyTermReferenceField($field_name, $vocabulary) {
$field = array(
entity_create('field_entity', array(
'field_name' => $field_name,
'type' => 'taxonomy_term_reference',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
......@@ -153,14 +165,12 @@ protected function createTaxonomyTermReferenceField($field_name, $vocabulary) {
),
),
),
);
field_create_field($field);
$instance = array(
))->save();
entity_create('field_instance', array(
'field_name' => $field_name,
'entity_type' => 'node',
'bundle' => 'article',
);
field_create_instance($instance);
))->save();
entity_get_form_display('node', 'article', 'default')
->setComponent($field_name, array('type' => 'options_select'))
->save();
......@@ -168,4 +178,5 @@ protected function createTaxonomyTermReferenceField($field_name, $vocabulary) {
->setComponent($field_name, array('type' => 'taxonomy_term_reference_link'))
->save();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment