function AttributeHelperTest::providerTestMergeCollections

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php \Drupal\Tests\Core\Template\AttributeHelperTest::providerTestMergeCollections()
  2. 8.9.x core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php \Drupal\Tests\Core\Template\AttributeHelperTest::providerTestMergeCollections()
  3. 10 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 51

Class

AttributeHelperTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Template%21AttributeHelper.php/class/AttributeHelper/11.x" 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 static 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.