You are here

public function AttributeHelperTest::providerTestMergeCollections in Drupal 8

Same name and namespace in other branches
  1. 9 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',
      ],
    ],
  ];
}