function AttributeTest::providerTestHasAttribute

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

Provides tests data for testHasAttribute.

Return value

array An array of test data each containing an array of attributes, the name of the attribute to check existence of, and the expected result.

File

core/tests/Drupal/Tests/Core/Template/AttributeTest.php, line 474

Class

AttributeTest
@coversDefaultClass <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> @group Template

Namespace

Drupal\Tests\Core\Template

Code

public static function providerTestHasAttribute() {
    return [
        [
            [
                'class' => [
                    'example-class',
                ],
            ],
            'class',
            TRUE,
        ],
        [
            [],
            'class',
            FALSE,
        ],
        [
            [
                'class' => [
                    'example-class',
                ],
            ],
            'id',
            FALSE,
        ],
        [
            [
                'class' => [
                    'example-class',
                ],
                'id' => 'foo',
            ],
            'id',
            TRUE,
        ],
        [
            [
                'id' => 'foo',
            ],
            'class',
            FALSE,
        ],
    ];
}

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