function BubbleableMetadataTest::testAddAttachments

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php \Drupal\Tests\Core\Render\BubbleableMetadataTest::testAddAttachments()
  2. 8.9.x core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php \Drupal\Tests\Core\Render\BubbleableMetadataTest::testAddAttachments()
  3. 11.x core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php \Drupal\Tests\Core\Render\BubbleableMetadataTest::testAddAttachments()

@covers ::addAttachments @covers ::setAttachments @dataProvider providerTestAddAttachments

This only tests at a high level, because it reuses existing logic. Detailed tests exist for the existing logic:

See also

testMergeAttachmentsLibraryMerging()

testMergeAttachmentsFeedMerging()

testMergeAttachmentsHtmlHeadMerging()

testMergeAttachmentsHtmlHeadLinkMerging()

testMergeAttachmentsHttpHeaderMerging()

File

core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php, line 112

Class

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

Namespace

Drupal\Tests\Core\Render

Code

public function testAddAttachments(BubbleableMetadata $initial, $attachments, BubbleableMetadata $expected) : void {
    $test = $initial;
    $test->addAttachments($attachments);
    $this->assertEquals($expected, $test);
}

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