public function NumberFieldRdfaTest::testFloatFormatterWithScaleExercised in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php \Drupal\rdf\Tests\Field\NumberFieldRdfaTest::testFloatFormatterWithScaleExercised()
Tests the float formatter with a scale. Scale is exercised.
File
- core/
modules/ rdf/ src/ Tests/ Field/ NumberFieldRdfaTest.php, line 127 - Contains \Drupal\rdf\Tests\Field\NumberFieldRdfaTest.
Class
- NumberFieldRdfaTest
- Tests RDFa output by number field formatters.
Namespace
Drupal\rdf\Tests\FieldCode
public function testFloatFormatterWithScaleExercised() {
\Drupal::service('theme_handler')
->install([
'classy',
]);
$this
->config('system.theme')
->set('default', 'classy')
->save();
$this->fieldType = 'float';
$formatter = array(
'type' => 'number_decimal',
'settings' => array(
'scale' => 5,
),
);
$testValue = 3.1234567;
$this
->createTestField();
$this
->createTestEntity($testValue);
$this
->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array(
'value' => $testValue,
));
// Test that the content attribute is created.
$result = $this
->xpathContent($this
->getRawContent(), '//div[contains(@class, "field__item") and @content=:testValue]', array(
':testValue' => $testValue,
));
$this
->assertTrue($result);
}