public function NumberFieldRdfaTest::testFloatFormatterWithSettings 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::testFloatFormatterWithSettings()
Tests the float formatter with settings.
File
- core/
modules/ rdf/ src/ Tests/ Field/ NumberFieldRdfaTest.php, line 77 - Contains \Drupal\rdf\Tests\Field\NumberFieldRdfaTest.
Class
- NumberFieldRdfaTest
- Tests RDFa output by number field formatters.
Namespace
Drupal\rdf\Tests\FieldCode
public function testFloatFormatterWithSettings() {
\Drupal::service('theme_handler')
->install([
'classy',
]);
$this
->config('system.theme')
->set('default', 'classy')
->save();
$this->fieldType = 'float';
$formatter = array(
'type' => 'number_decimal',
'settings' => array(
'thousand_separator' => '.',
'decimal_separator' => ',',
'prefix_suffix' => TRUE,
),
);
$testValue = 3333333.33;
$field_settings = array(
'prefix' => '$',
'suffix' => ' more.',
);
$this
->createTestField($field_settings);
$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);
}