function AttributesTest::testDrupalAttributes

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Common/AttributesTest.php \Drupal\Tests\Core\Common\AttributesTest::testDrupalAttributes()
  2. 8.9.x core/tests/Drupal/Tests/Core/Common/AttributesTest.php \Drupal\Tests\Core\Common\AttributesTest::testDrupalAttributes()
  3. 10 core/tests/Drupal/Tests/Core/Common/AttributesTest.php \Drupal\Tests\Core\Common\AttributesTest::testDrupalAttributes()

Tests casting an Attribute object to a string.

@dataProvider providerTestAttributeData

See also

\Drupal\Core\Template\Attribute::__toString()

File

core/tests/Drupal/Tests/Core/Common/AttributesTest.php, line 57

Class

AttributesTest
Tests the <a href="/api/drupal/core%21lib%21Drupal%21Core%21Template%21Attribute.php/class/Attribute/11.x" title="Collects, sanitizes, and renders HTML attributes." class="local">Drupal\Core\Template\Attribute</a> functionality.

Namespace

Drupal\Tests\Core\Common

Code

public function testDrupalAttributes($attributes, $expected, $message) : void {
    $this->assertSame($expected, (string) new Attribute($attributes), $message);
}

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