BubbleableMetadataTest.php

Same filename in this branch
  1. 9 core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
Same filename and directory in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
  2. 10 core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
  3. 11.x core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php

Namespace

Drupal\Tests\aggregator\Unit

File

core/modules/aggregator/tests/src/Unit/BubbleableMetadataTest.php

View source
<?php

namespace Drupal\Tests\aggregator\Unit;

use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Tests\UnitTestCase;

/**
 * @coversDefaultClass \Drupal\Core\Render\BubbleableMetadata
 * @group aggregator
 * @group legacy
 */
class BubbleableMetadataTest extends UnitTestCase {
  
  /**
   * Tests feed asset merging.
   *
   * @covers ::mergeAttachments
   *
   * @dataProvider providerTestMergeAttachmentsFeedMerging
   */
  public function testMergeAttachmentsFeedMerging($a, $b, $expected) {
    $this->assertSame($expected, BubbleableMetadata::mergeAttachments($a, $b));
  }
  
  /**
   * Data provider for testMergeAttachmentsFeedMerging.
   *
   * @return array
   */
  public function providerTestMergeAttachmentsFeedMerging() {
    $feed_a = [
      'aggregator/rss',
      'Feed title',
    ];
    $feed_b = [
      'taxonomy/term/1/feed',
      'RSS - foo',
    ];
    $a = [
      'feed' => [
        $feed_a,
      ],
    ];
    $b = [
      'feed' => [
        $feed_b,
      ],
    ];
    $expected_a = [
      'feed' => [
        $feed_a,
        $feed_b,
      ],
    ];
    // Merging in the opposite direction yields the opposite library order.
    $expected_b = [
      'feed' => [
        $feed_b,
        $feed_a,
      ],
    ];
    return [
      [
        $a,
        $b,
        $expected_a,
      ],
      [
        $b,
        $a,
        $expected_b,
      ],
    ];
  }

}

Classes

Title Deprecated Summary
BubbleableMetadataTest @coversDefaultClass \Drupal\Core\Render\BubbleableMetadata[[api-linebreak]] @group aggregator @group legacy

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