function NumberFieldRdfaTest::testDecimalFormatter

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

Tests the decimal formatter.

File

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

Class

NumberFieldRdfaTest
Tests RDFa output by number field formatters.

Namespace

Drupal\Tests\rdf\Kernel\Field

Code

public function testDecimalFormatter() {
    $this->fieldType = 'decimal';
    $testValue = 3.33;
    $this->createTestField();
    $this->createTestEntity($testValue);
    $this->assertFormatterRdfa([
        'type' => 'number_decimal',
    ], '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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.