function AttributeHelperTest::providerTestMergeCollections

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

Provides tests data for testMergeCollections.

Return value

array An array of test data each containing an initial attribute collection, an Attribute object or array to be merged, and the expected result.

File

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

Class

AttributeHelperTest
Tests Drupal\Core\Template\AttributeHelper.

Namespace

Drupal\Tests\Core\Template

Code

public static function providerTestMergeCollections() : array {
  return [
    [
      [],
      [
        'class' => [
          'class1',
        ],
      ],
      [
        'class' => [
          'class1',
        ],
      ],
    ],
    [
      [],
      new Attribute([
        'class' => [
          'class1',
        ],
      ]),
      [
        'class' => [
          'class1',
        ],
      ],
    ],
    [
      [
        'class' => [
          'example-class',
        ],
      ],
      [
        'class' => [
          'class1',
        ],
      ],
      [
        'class' => [
          'example-class',
          'class1',
        ],
      ],
    ],
    [
      [
        'class' => [
          'example-class',
        ],
      ],
      new Attribute([
        'class' => [
          'class1',
        ],
      ]),
      [
        'class' => [
          'example-class',
          'class1',
        ],
      ],
    ],
    [
      [
        'class' => [
          'example-class',
        ],
      ],
      [
        'id' => 'foo',
        'href' => 'bar',
      ],
      [
        'class' => [
          'example-class',
        ],
        'id' => 'foo',
        'href' => 'bar',
      ],
    ],
    [
      [
        'class' => [
          'example-class',
        ],
      ],
      new Attribute([
        'id' => 'foo',
        'href' => 'bar',
      ]),
      [
        'class' => [
          'example-class',
        ],
        'id' => 'foo',
        'href' => 'bar',
      ],
    ],
  ];
}

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