public function EntityEmbedCollectorTest::testExtractEmbeddedEntities in Dependency Calculation 8
Test dependency calculation.
Checks the node's dependencies contains embedded entities.
@dataProvider providerTestExtractEmbeddedEntities
Parameters
array $embed_attributes: Attributes to add for the embedded entity.
File
- tests/
src/ Kernel/ EventSubscriber/ DependencyCollector/ EntityEmbedCollectorTest.php, line 76
Class
- EntityEmbedCollectorTest
- Class EntityEmbedCollectorTest.
Namespace
Drupal\Tests\depcalc\Kernel\EventSubscriber\DependencyCollectorCode
public function testExtractEmbeddedEntities(array $embed_attributes) {
$embed_code = '';
foreach ($embed_attributes as $embed_attribute) {
$embed_code .= $this
->createEmbedCode($embed_attribute);
}
$node = $this
->drupalCreateNode([
'body' => [
[
'value' => $embed_code,
'format' => filter_default_format(),
],
],
]);
try {
$wrapper = new DependentEntityWrapper($node);
} catch (\Exception $exception) {
$this
->markTestIncomplete($exception
->getMessage());
}
$dependencies = $this->calculator
->calculateDependencies($wrapper, new DependencyStack());
foreach ($embed_attributes as $embed_attribute) {
$this
->assertArrayHasKey($embed_attribute['data-entity-uuid'], $dependencies);
}
}