function AttributeHelperTest::testAttributeExists

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php \Drupal\Tests\Core\Template\AttributeHelperTest::testAttributeExists()
  2. 10 core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php \Drupal\Tests\Core\Template\AttributeHelperTest::testAttributeExists()
  3. 9 core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php \Drupal\Tests\Core\Template\AttributeHelperTest::testAttributeExists()
  4. 8.9.x core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php \Drupal\Tests\Core\Template\AttributeHelperTest::testAttributeExists()

Tests attribute exists.

Attributes

#[DataProvider('providerTestAttributeExists')]

File

core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php, line 41

Class

AttributeHelperTest
Tests Drupal\Core\Template\AttributeHelper.

Namespace

Drupal\Tests\Core\Template

Code

public function testAttributeExists(array $test_data, $test_attribute, $expected) : void {
  $this->assertSame($expected, AttributeHelper::attributeExists($test_attribute, $test_data));
  $attributes = new Attribute($test_data);
  $this->assertSame($expected, AttributeHelper::attributeExists($test_attribute, $attributes));
}

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