You are here

public function NumberFieldRdfaTest::testFloatFormatter in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php \Drupal\Tests\rdf\Kernel\Field\NumberFieldRdfaTest::testFloatFormatter()
  2. 10 core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php \Drupal\Tests\rdf\Kernel\Field\NumberFieldRdfaTest::testFloatFormatter()

Tests the float formatter.

File

core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php, line 60

Class

NumberFieldRdfaTest
Tests RDFa output by number field formatters.

Namespace

Drupal\Tests\rdf\Kernel\Field

Code

public function testFloatFormatter() {
  $this->fieldType = 'float';
  $testValue = 3.33;
  $this
    ->createTestField();
  $this
    ->createTestEntity($testValue);
  $this
    ->assertFormatterRdfa([
    'type' => 'number_unformatted',
  ], 'http://schema.org/baseSalary', [
    'value' => $testValue,
  ]);

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