function AttributeHelperTest::providerTestAttributeExists

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

Provides tests data for testAttributeExists.

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/AttributeHelperTest.php, line 22

Class

AttributeHelperTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Template%21AttributeHelper.php/class/AttributeHelper/9" title="Helper class to deal with mixed array and Attribute operations." class="local">\Drupal\Core\Template\AttributeHelper</a> @group Template

Namespace

Drupal\Tests\Core\Template

Code

public function providerTestAttributeExists() {
    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.