function BubbleableMetadataTest::providerTestMergeAttachmentsHtmlHeadLinkMerging

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

Class

BubbleableMetadataTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Render%21BubbleableMetadata.php/class/BubbleableMetadata/11.x" title="Value object used for bubbleable rendering metadata." class="local">\Drupal\Core\Render\BubbleableMetadata</a> @group Render

Namespace

Drupal\Tests\Core\Render

Code

public static 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.