function MediaEmbedFilterTest::testFilterIntegration

Same name in other branches
  1. 9 core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTest::testFilterIntegration()
  2. 8.9.x core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTest::testFilterIntegration()
  3. 10 core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTest::testFilterIntegration()

@covers \Drupal\filter\Plugin\Filter\FilterAlign @covers \Drupal\filter\Plugin\Filter\FilterCaption @dataProvider providerFilterIntegration

File

core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php, line 401

Class

MediaEmbedFilterTest
@coversDefaultClass \Drupal\media\Plugin\Filter\MediaEmbed @group media

Namespace

Drupal\Tests\media\Kernel

Code

public function testFilterIntegration(array $filter_ids, array $additional_attributes, $verification_selector, $expected_verification_success, array $expected_asset_libraries = [], $prefix = '', $suffix = '') : void {
    $content = $this->createEmbedCode([
        'data-entity-type' => 'media',
        'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
    ] + $additional_attributes);
    $content = $prefix . $content . $suffix;
    $result = $this->processText($content, 'en', $filter_ids);
    $this->setRawContent($result->getProcessedText());
    $this->assertCount($expected_verification_success ? 1 : 0, $this->cssSelect($verification_selector));
    $this->assertCount(1, $this->cssSelect('div[data-media-embed-test-view-mode="default"]'));
    $this->assertEqualsCanonicalizing([
        '_media_test_embed_filter_access:media:1',
        '_media_test_embed_filter_access:user:2',
        'config:image.style.thumbnail',
        'file:1',
        'media:1',
        'media_view',
        'user:2',
    ], $result->getCacheTags());
    $this->assertEqualsCanonicalizing([
        'timezone',
        'user.permissions',
    ], $result->getCacheContexts());
    $this->assertSame(Cache::PERMANENT, $result->getCacheMaxAge());
    $this->assertSame([
        'library',
    ], array_keys($result->getAttachments()));
    $this->assertSame($expected_asset_libraries, $result->getAttachments()['library']);
}

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