diff --git a/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php b/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php index 36e5a6c..c9246d0 100644 --- a/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php +++ b/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php @@ -34,14 +34,25 @@ public function testIntegerFormatter() { } /** - * Tests the decimal formatter. + * Tests the integer formatter with settings. */ - public function testDecimalFormatter() { - $this->fieldType = 'decimal'; - $this->testValue = 3.33; - $this->createTestField(); + public function testIntegerFormatterWithSettings() { + $this->fieldType = 'integer'; + $formatter = array( + 'type' => $this->fieldType, + 'settings' => array( + 'thousand_separator' => '.', + 'prefix_suffix' => TRUE, + ), + ); + $this->testValue = 3333333.33; + $field_instance_settings = array( + 'prefix' => '#', + 'suffix' => ' llamas.', + ); + $this->createTestField($field_instance_settings); $this->createTestEntity(); - $this->assertFormatterRdfa(array('type' => $this->fieldType), 'http://schema.org/baseSalary', array('value' => $this->testValue)); + $this->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array('value' => $this->testValue)); } /** @@ -56,14 +67,64 @@ public function testFloatFormatter() { } /** + * Tests the float formatter with settings. + */ + public function testFloatFormatterWithSettings() { + $this->fieldType = 'float'; + $formatter = array( + 'type' => $this->fieldType, + 'settings' => array( + 'thousand_separator' => '.', + 'decimal_separator' => ',', + 'prefix_suffix' => TRUE, + ), + ); + $this->testValue = 3333333.33; + $field_instance_settings = array( + 'prefix' => '$', + 'suffix' => ' more.', + ); + $this->createTestField($field_instance_settings); + $this->createTestEntity(); + $this->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array('value' => $this->testValue)); + } + + /** + * Tests the float formatter with a scale. + */ + public function testFloatFormatterWithScale() { + $this->fieldType = 'float'; + $formatter = array( + 'type' => $this->fieldType, + 'settings' => array( + 'scale' => 5, + ), + ); + $this->testValue = 3.33; + $this->createTestField(); + $this->createTestEntity(); + $this->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array('value' => $this->testValue)); + } + + /** * Tests the decimal formatter. */ + public function testDecimalFormatter() { + $this->fieldType = 'decimal'; + $this->testValue = 3.33; + $this->createTestField(); + $this->createTestEntity(); + $this->assertFormatterRdfa(array('type' => $this->fieldType), 'http://schema.org/baseSalary', array('value' => $this->testValue)); + } + + /** + * Tests the decimal formatter with settings. + */ public function testDecimalFormatterWithSettings() { $this->fieldType = 'decimal'; $formatter = array( 'type' => $this->fieldType, 'settings' => array( - 'url_plain' => FALSE, 'thousand_separator' => 't', 'decimal_separator' => '#', 'prefix_suffix' => TRUE,