function MediaEmbedFilterTest::providerFilterIntegration
Same name in other branches
- 9 core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTest::providerFilterIntegration()
- 8.9.x core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTest::providerFilterIntegration()
- 11.x core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTest::providerFilterIntegration()
Data provider for testFilterIntegration().
File
-
core/
modules/ media/ tests/ src/ Kernel/ MediaEmbedFilterTest.php, line 431
Class
- MediaEmbedFilterTest
- @coversDefaultClass \Drupal\media\Plugin\Filter\MediaEmbed @group media @group #slow
Namespace
Drupal\Tests\media\KernelCode
public static function providerFilterIntegration() {
$default_asset_libraries = [
'media/filter.caption',
];
$caption_additional_attributes = [
'data-caption' => 'Yo.',
];
$caption_verification_selector = 'figure > figcaption';
$caption_test_cases = [
'`data-caption`; only `media_embed` ⇒ caption absent' => [
[
'media_embed',
],
$caption_additional_attributes,
$caption_verification_selector,
FALSE,
$default_asset_libraries,
],
'`data-caption`; `filter_caption` + `media_embed` ⇒ caption present' => [
[
'filter_caption',
'media_embed',
],
$caption_additional_attributes,
$caption_verification_selector,
TRUE,
[
'filter/caption',
'media/filter.caption',
],
],
'`<a>` + `data-caption`; `filter_caption` + `media_embed` ⇒ caption present, link preserved' => [
[
'filter_caption',
'media_embed',
],
$caption_additional_attributes,
'figure > a[href="https://www.drupal.org"] + figcaption',
TRUE,
[
'filter/caption',
'media/filter.caption',
],
'<a href="https://www.drupal.org">',
'</a>',
],
];
$align_additional_attributes = [
'data-align' => 'center',
];
$align_verification_selector = 'div[data-media-embed-test-view-mode].align-center';
$align_test_cases = [
'`data-align`; `media_embed` ⇒ alignment absent' => [
[
'media_embed',
],
$align_additional_attributes,
$align_verification_selector,
FALSE,
$default_asset_libraries,
],
'`data-align`; `filter_align` + `media_embed` ⇒ alignment present' => [
[
'filter_align',
'media_embed',
],
$align_additional_attributes,
$align_verification_selector,
TRUE,
$default_asset_libraries,
],
'`<a>` + `data-align`; `filter_align` + `media_embed` ⇒ alignment present, link preserved' => [
[
'filter_align',
'media_embed',
],
$align_additional_attributes,
'a[href="https://www.drupal.org"] > div[data-media-embed-test-view-mode].align-center',
TRUE,
$default_asset_libraries,
'<a href="https://www.drupal.org">',
'</a>',
],
];
$caption_and_align_test_cases = [
'`data-caption` + `data-align`; `filter_align` + `filter_caption` + `media_embed` ⇒ aligned caption present' => [
[
'filter_align',
'filter_caption',
'media_embed',
],
$align_additional_attributes + $caption_additional_attributes,
'figure.align-center > figcaption',
TRUE,
[
'filter/caption',
'media/filter.caption',
],
],
'`<a>` + `data-caption` + `data-align`; `filter_align` + `filter_caption` + `media_embed` ⇒ aligned caption present, link preserved' => [
[
'filter_align',
'filter_caption',
'media_embed',
],
$align_additional_attributes + $caption_additional_attributes,
'figure.align-center > a[href="https://www.drupal.org"] + figcaption',
TRUE,
[
'filter/caption',
'media/filter.caption',
],
'<a href="https://www.drupal.org">',
'</a>',
],
];
return $caption_test_cases + $align_test_cases + $caption_and_align_test_cases;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.