diff --git a/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php b/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php new file mode 100644 index 0000000..0057a36 --- /dev/null +++ b/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php @@ -0,0 +1,76 @@ +fieldType = 'integer'; + $this->testValue = 3; + $this->createMapping(); + $this->assertFormatterRdfa(array('type' => $this->fieldType), 'http://schema.org/baseSalary', array('value' => $this->testValue)); + } + + /** + * Tests the decimal formatter. + */ + public function testDecimalFormatter() { + $this->fieldType = 'decimal'; + $this->testValue = 3.33; + $this->createMapping(); + $this->assertFormatterRdfa(array('type' => $this->fieldType), 'http://schema.org/baseSalary', array('value' => $this->testValue)); + } + + /** + * Tests the float formatter. + */ + public function testFloatFormatter() { + $this->fieldType = 'float'; + $this->testValue = 3.33; + $this->createMapping(); + $this->assertFormatterRdfa(array('type' => $this->fieldType), 'http://schema.org/baseSalary', array('value' => $this->testValue)); + } + + /** + * Create the RDF mapping for the field. + */ + protected function createMapping() { + $this->createTestField(); + + // Add the mapping. + $mapping = rdf_get_mapping('entity_test', 'entity_test'); + $mapping->setFieldMapping($this->fieldName, array( + 'properties' => array('schema:baseSalary'), + ))->save(); + + // Set up test entity. + $this->entity = entity_create('entity_test', array()); + $this->entity->{$this->fieldName}->value = $this->testValue; + } +}