You are here

public function BubbleableMetadataTest::testAddAttachments in Drupal 9

Same name and namespace in other branches
  1. 8 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 113

Class

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

Namespace

Drupal\Tests\Core\Render

Code

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