function MediaEmbedFilterTest::testRecursionProtection
Same name in other branches
- 9 core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTest::testRecursionProtection()
- 10 core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTest::testRecursionProtection()
- 11.x core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTest::testRecursionProtection()
Tests recursive rendering protection.
File
-
core/
modules/ media/ tests/ src/ Kernel/ MediaEmbedFilterTest.php, line 377
Class
- MediaEmbedFilterTest
- @coversDefaultClass \Drupal\media\Plugin\Filter\MediaEmbed @group media
Namespace
Drupal\Tests\media\KernelCode
public function testRecursionProtection() {
$text = $this->createEmbedCode([
'data-entity-type' => 'media',
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
]);
// Render and verify the presence of the embedded entity 20 times.
for ($i = 0; $i < 20; $i++) {
$this->applyFilter($text);
$this->assertCount(1, $this->cssSelect('div[data-media-embed-test-view-mode="default"]'));
}
// Render a 21st time, this is exceeding the recursion limit. The entity
// embed markup will be stripped.
$this->applyFilter($text);
$this->assertEmpty($this->getRawContent());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.