function AttributeHelperTest::providerTestMergeCollections

Same name in other branches
  1. 8.9.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. 11.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 49

Class

AttributeHelperTest
@coversDefaultClass \Drupal\Core\Template\AttributeHelper @group Template

Namespace

Drupal\Tests\Core\Template

Code

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