diff --git a/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php b/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php index 0057a36..98c9881 100644 --- a/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php +++ b/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php @@ -41,7 +41,7 @@ public function testIntegerFormatter() { * Tests the decimal formatter. */ public function testDecimalFormatter() { - $this->fieldType = 'decimal'; + $this->fieldType = 'decimal_with_separator'; $this->testValue = 3.33; $this->createMapping(); $this->assertFormatterRdfa(array('type' => $this->fieldType), 'http://schema.org/baseSalary', array('value' => $this->testValue)); @@ -58,6 +58,24 @@ public function testFloatFormatter() { } /** + * Tests the decimal formatter. + */ + public function testDecimalFormatterWithSettings() { + $this->fieldType = 'decimal_with_separator'; + $formatter = array( + 'type' => $this->fieldType, + 'settings' => array( + 'prefix' => '$', + 'suffix' => ' more.', + 'url_plain' => FALSE, + ), + ); + $this->testValue = 3.33; + $this->createMapping(); + $this->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array('value' => $this->testValue)); + } + + /** * Create the RDF mapping for the field. */ protected function createMapping() { @@ -69,8 +87,32 @@ protected function createMapping() { 'properties' => array('schema:baseSalary'), ))->save(); + $mapping->setFieldMapping('field_with_separator', array( + 'properties' => array('schema:baseSalary'), + ))->save(); + // Set up test entity. $this->entity = entity_create('entity_test', array()); $this->entity->{$this->fieldName}->value = $this->testValue; } + + /** + * Creates the field for testing. + */ + protected function createTestField() { + parent::createTestField(); + entity_create('field_config_with_separator', array( + 'name' => 'field_with_separator', + 'entity_type' => 'entity_test', + 'type' => 'decimal_with_separator', + 'settings' => array( + 'decimal_separator' => '.', + ) + ))->save(); + entity_create('field_instance_config_with_separator', array( + 'entity_type' => 'entity_test', + 'field_name' => 'field_with_separator', + 'bundle' => 'entity_test', + ))->save(); + } }