function AttributeTest::providerTestMerge

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

Class

AttributeTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Template%21Attribute.php/class/Attribute/9" title="Collects, sanitizes, and renders HTML attributes." class="local">\Drupal\Core\Template\Attribute</a> @group Template

Namespace

Drupal\Tests\Core\Template

Code

public 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.