function MediaEmbedFilterTestBase::createEmbedCode
Same name in other branches
- 9 core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTestBase::createEmbedCode()
- 8.9.x core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTestBase::createEmbedCode()
- 11.x core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTestBase::createEmbedCode()
Gets an embed code with given attributes.
Parameters
array $attributes: The attributes to add.
Return value
string A string containing a drupal-media DOM element.
See also
assertEntityEmbedFilterHasRun()
9 calls to MediaEmbedFilterTestBase::createEmbedCode()
- MediaEmbedFilterDisabledIntegrationsTest::testDisabledIntegrations in core/
modules/ media/ tests/ src/ Kernel/ MediaEmbedFilterDisabledIntegrationsTest.php - @covers ::renderMedia @covers ::disableContextualLinks
- MediaEmbedFilterTest::testAccessUnpublished in core/
modules/ media/ tests/ src/ Kernel/ MediaEmbedFilterTest.php - Tests that entity access is respected by embedding an unpublished entity.
- MediaEmbedFilterTest::testBasics in core/
modules/ media/ tests/ src/ Kernel/ MediaEmbedFilterTest.php - Ensures media entities are rendered correctly.
- MediaEmbedFilterTest::testFilterIntegration in core/
modules/ media/ tests/ src/ Kernel/ MediaEmbedFilterTest.php - @covers \Drupal\filter\Plugin\Filter\FilterAlign @covers \Drupal\filter\Plugin\Filter\FilterCaption @dataProvider providerFilterIntegration
- MediaEmbedFilterTest::testMissingEntityIndicator in core/
modules/ media/ tests/ src/ Kernel/ MediaEmbedFilterTest.php - Tests the indicator for missing entities.
File
-
core/
modules/ media/ tests/ src/ Kernel/ MediaEmbedFilterTestBase.php, line 156
Class
- MediaEmbedFilterTestBase
- Base class for Media Embed filter tests.
Namespace
Drupal\Tests\media\KernelCode
protected function createEmbedCode(array $attributes) {
$dom = Html::load('<drupal-media>This placeholder should not be rendered.</drupal-media>');
$xpath = new \DOMXPath($dom);
$drupal_entity = $xpath->query('//drupal-media')[0];
foreach ($attributes as $attribute => $value) {
$drupal_entity->setAttribute($attribute, $value);
}
return Html::serialize($dom);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.