function BubbleableMetadataTest::providerTestMergeAttachmentsHtmlHeadLinkMerging

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php \Drupal\Tests\Core\Render\BubbleableMetadataTest::providerTestMergeAttachmentsHtmlHeadLinkMerging()
  2. 10 core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php \Drupal\Tests\Core\Render\BubbleableMetadataTest::providerTestMergeAttachmentsHtmlHeadLinkMerging()
  3. 11.x 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 472

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,
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.