public function RecursionProtectionTest::testSelfEmbedding in Entity Embed 8
Tests self embedding.
File
- tests/
src/ Functional/ RecursionProtectionTest.php, line 19
Class
- RecursionProtectionTest
- Tests recursive rendering protection.
Namespace
Drupal\Tests\entity_embed\FunctionalCode
public function testSelfEmbedding() {
$node = $this
->drupalCreateNode([
'type' => 'article',
'title' => "Pirate Chinchilla LLama",
'body' => [
'value' => 'temp',
'format' => 'custom_format',
],
]);
$node
->save();
$content = '<div class="pirate">Ahoy, Matey!</div> <drupal-entity data-entity-type="node" data-entity-uuid="' . $node
->uuid() . '" data-entity-embed-display="view_mode:node.full"></drupal-entity>';
$node
->set('body', [
'value' => $content,
'format' => 'custom_format',
]);
$node
->save();
$this
->drupalGet('node/' . $node
->id());
$this
->assertCount(EntityEmbedFilter::RECURSIVE_RENDER_LIMIT + 1, $this
->getSession()
->getPage()
->findAll('xpath', '//div[@class="pirate"]'));
}