public function ButtonAdminTest::testEmbedButtonAdmin in Entity Embed 8
Tests the entity embed button administration functionality.
@dataProvider embedButtonAdminProvider
Parameters
string $entity_type_id: The entity type ID as well as the label and machine name of the button.
string $bundle_id: The bundle to select, if provided.
string $entity_embed_display_plugin_id: The entity embed display plugin ID to select on the form.
File
- tests/
src/ FunctionalJavascript/ ButtonAdminTest.php, line 88
Class
- ButtonAdminTest
- Tests the creation and configuration of entity embed buttons.
Namespace
Drupal\Tests\entity_embed\FunctionalJavascriptCode
public function testEmbedButtonAdmin($entity_type_id, $bundle_id, $entity_embed_display_plugin_id) {
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/config/content/embed/button/add');
$page = $this
->getSession()
->getPage();
$page
->fillField('label', $entity_type_id);
$page
->selectFieldOption('type_id', 'entity');
$page
->waitFor(10, function () use ($page) {
return $page
->hasField('type_settings[entity_type]');
});
$page
->selectFieldOption('type_settings[entity_type]', $entity_type_id);
$page
->waitFor(10, function () use ($page, $bundle_id) {
return $page
->hasField('type_settings[bundles][' . $bundle_id . ']');
});
$page
->checkField('type_settings[display_plugins][' . $entity_embed_display_plugin_id . ']');
$page
->pressButton('Save');
$this
->assertStringContainsString('The embed button ' . $entity_type_id . ' has been added.', $page
->getText());
$this
->assertSession()
->linkByHrefExists('/admin/config/content/embed/button/manage/' . $entity_type_id);
$this
->drupalGet('/admin/config/content/embed/button/manage/' . $entity_type_id);
$page
->findField('type_id')
->hasAttribute('disabled');
$page
->findField('type_settings[entity_type]')
->hasAttribute('disabled');
}