You are here

public function AttributeHelperTest::providerTestAttributeExists in Drupal 8

Same name and namespace in other branches
  1. 9 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 \Drupal\Core\Template\AttributeHelper @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,
    ],
  ];
}