function AttributeTest::providerTestMerge

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::providerTestMerge()
  2. 8.9.x core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::providerTestMerge()
  3. 11.x core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::providerTestMerge()

Provides tests data for testMerge.

Return value

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

File

core/tests/Drupal/Tests/Core/Template/AttributeTest.php, line 500

Class

AttributeTest
@coversDefaultClass \Drupal\Core\Template\Attribute @group Template

Namespace

Drupal\Tests\Core\Template

Code

public static function providerTestMerge() {
    return [
        [
            new Attribute([]),
            new Attribute([
                'class' => [
                    'class1',
                ],
            ]),
            new Attribute([
                'class' => [
                    'class1',
                ],
            ]),
        ],
        [
            new Attribute([
                'class' => [
                    'example-class',
                ],
            ]),
            new Attribute([
                'class' => [
                    'class1',
                ],
            ]),
            new Attribute([
                'class' => [
                    'example-class',
                    'class1',
                ],
            ]),
        ],
        [
            new Attribute([
                'class' => [
                    'example-class',
                ],
            ]),
            new Attribute([
                'id' => 'foo',
                'href' => 'bar',
            ]),
            new Attribute([
                '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.