You are here

public function BubbleableMetadataTest::providerTestMergeAttachmentsHtmlHeadMerging in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php \Drupal\Tests\Core\Render\BubbleableMetadataTest::providerTestMergeAttachmentsHtmlHeadMerging()

Data provider for testMergeAttachmentsHtmlHeadMerging

Return value

array

File

core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php, line 468
Contains \Drupal\Tests\Core\Render\BubbleableMetadataTest.

Class

BubbleableMetadataTest
@coversDefaultClass \Drupal\Core\Render\BubbleableMetadata @group Render

Namespace

Drupal\Tests\Core\Render

Code

public function providerTestMergeAttachmentsHtmlHeadMerging() {
  $meta = [
    '#tag' => 'meta',
    '#attributes' => [
      'charset' => 'utf-8',
    ],
    '#weight' => -1000,
  ];
  $html_tag = [
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#attributes' => [
      'name' => 'Generator',
      'content' => 'Kitten 1.0 (https://www.drupal.org/project/kitten)',
    ],
  ];
  $a = [
    'html_head' => [
      $meta,
      'system_meta_content_type',
    ],
  ];
  $b = [
    'html_head' => [
      $html_tag,
      'system_meta_generator',
    ],
  ];
  $expected_a = [
    'html_head' => [
      $meta,
      'system_meta_content_type',
      $html_tag,
      'system_meta_generator',
    ],
  ];

  // Merging in the opposite direction yields the opposite library order.
  $expected_b = [
    'html_head' => [
      $html_tag,
      'system_meta_generator',
      $meta,
      'system_meta_content_type',
    ],
  ];
  return [
    [
      $a,
      $b,
      $expected_a,
    ],
    [
      $b,
      $a,
      $expected_b,
    ],
  ];
}