You are here

public function NumberFieldRdfaTest::testFloatFormatterWithScale in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php \Drupal\rdf\Tests\Field\NumberFieldRdfaTest::testFloatFormatterWithScale()

Tests the float formatter with a scale. Scale is not exercised.

File

core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php, line 106
Contains \Drupal\rdf\Tests\Field\NumberFieldRdfaTest.

Class

NumberFieldRdfaTest
Tests RDFa output by number field formatters.

Namespace

Drupal\rdf\Tests\Field

Code

public function testFloatFormatterWithScale() {
  $this->fieldType = 'float';
  $formatter = array(
    'type' => 'number_decimal',
    'settings' => array(
      'scale' => 5,
    ),
  );
  $testValue = 3.33;
  $this
    ->createTestField();
  $this
    ->createTestEntity($testValue);
  $this
    ->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array(
    'value' => $testValue,
  ));

  // Test that the content attribute is not created.
  $result = $this
    ->xpathContent($this
    ->getRawContent(), '//div[contains(@class, "field__items") and @content]');
  $this
    ->assertFalse($result);
}