You are here

public function BubbleableMetadataTest::providerTestMergeAttachmentsHtmlHeadLinkMerging 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::providerTestMergeAttachmentsHtmlHeadLinkMerging()

Data provider for testMergeAttachmentsHtmlHeadLinkMerging

Return value

array

File

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

Class

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

Namespace

Drupal\Tests\Core\Render

Code

public function providerTestMergeAttachmentsHtmlHeadLinkMerging() {
  $rel = [
    'rel' => 'rel',
    'href' => 'http://rel.example.com',
  ];
  $shortlink = [
    'rel' => 'shortlink',
    'href' => 'http://shortlink.example.com',
  ];
  $a = [
    'html_head_link' => [
      $rel,
      TRUE,
    ],
  ];
  $b = [
    'html_head_link' => [
      $shortlink,
      FALSE,
    ],
  ];
  $expected_a = [
    'html_head_link' => [
      $rel,
      TRUE,
      $shortlink,
      FALSE,
    ],
  ];

  // Merging in the opposite direction yields the opposite library order.
  $expected_b = [
    'html_head_link' => [
      $shortlink,
      FALSE,
      $rel,
      TRUE,
    ],
  ];
  return [
    [
      $a,
      $b,
      $expected_a,
    ],
    [
      $b,
      $a,
      $expected_b,
    ],
  ];
}