diff --git a/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php b/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php index f38a106..36e5a6c 100644 --- a/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php +++ b/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php @@ -23,17 +23,13 @@ class NumberFieldRdfaTest extends FieldRdfaTestBase { protected $testValue = 'test_text_value'; /** - * {@inheritdoc} - */ - public static $modules = array('number'); - - /** * Tests the integer formatter. */ public function testIntegerFormatter() { $this->fieldType = 'integer'; $this->testValue = 3; - $this->createMapping(); + $this->createTestField(); + $this->createTestEntity(); $this->assertFormatterRdfa(array('type' => $this->fieldType), 'http://schema.org/baseSalary', array('value' => $this->testValue)); } @@ -43,7 +39,8 @@ public function testIntegerFormatter() { public function testDecimalFormatter() { $this->fieldType = 'decimal'; $this->testValue = 3.33; - $this->createMapping(); + $this->createTestField(); + $this->createTestEntity(); $this->assertFormatterRdfa(array('type' => $this->fieldType), 'http://schema.org/baseSalary', array('value' => $this->testValue)); } @@ -53,7 +50,8 @@ public function testDecimalFormatter() { public function testFloatFormatter() { $this->fieldType = 'float'; $this->testValue = 3.33; - $this->createMapping(); + $this->createTestField(); + $this->createTestEntity(); $this->assertFormatterRdfa(array('type' => $this->fieldType), 'http://schema.org/baseSalary', array('value' => $this->testValue)); } @@ -72,20 +70,19 @@ public function testDecimalFormatterWithSettings() { ), ); $this->testValue = 3333333.33; - $field_settings = array( + $field_instance_settings = array( 'prefix' => '$', 'suffix' => ' more.', ); - $this->createMapping($field_settings); + $this->createTestField($field_instance_settings); + $this->createTestEntity(); $this->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array('value' => $this->testValue)); } /** * Create the RDF mapping for the field. */ - protected function createMapping($field_settings = array()) { - $this->createTestField($field_settings); - + protected function createTestEntity() { // Add the mapping. $mapping = rdf_get_mapping('entity_test', 'entity_test'); $mapping->setFieldMapping($this->fieldName, array( @@ -96,21 +93,4 @@ protected function createMapping($field_settings = array()) { $this->entity = entity_create('entity_test', array()); $this->entity->{$this->fieldName}->value = $this->testValue; } - - /** - * Creates the field for testing. - */ - protected function createTestField($field_settings = array()) { - entity_create('field_storage_config', array( - 'name' => $this->fieldName, - 'entity_type' => 'entity_test', - 'type' => $this->fieldType, - ))->save(); - entity_create('field_instance_config', array( - 'entity_type' => 'entity_test', - 'field_name' => $this->fieldName, - 'bundle' => 'entity_test', - 'settings' => $field_settings, - ))->save(); - } }