public function EntityEmbedHooksTest::testDisplayPluginAlterHooks in Entity Embed 8
Tests hook_entity_embed_display_plugins_alter().
File
- tests/
src/ Functional/ EntityEmbedHooksTest.php, line 30
Class
- EntityEmbedHooksTest
- Tests the hooks provided by entity_embed module.
Namespace
Drupal\Tests\entity_embed\FunctionalCode
public function testDisplayPluginAlterHooks() {
// Enable entity_embed_test.module's
// hook_entity_embed_display_plugins_alter() implementation and ensure it is
// working as designed.
$this->state
->set('entity_embed_test_entity_embed_display_plugins_alter', TRUE);
$plugins = $this->container
->get('plugin.manager.entity_embed.display')
->getDefinitionOptionsForEntity($this->node);
// Ensure that name of each plugin is prefixed with 'testing_hook:'.
foreach ($plugins as $plugin => $plugin_info) {
$this
->assertTrue(strpos($plugin, 'testing_hook:') === 0, 'Name of the plugin is prefixed by hook_entity_embed_display_plugins_alter()');
}
}