You are here

public function AttributeTest::providerTestMerge in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::providerTestMerge()
  2. 9 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 \Drupal\Core\Template\Attribute @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',
      ]),
    ],
  ];
}