protected function MediaBehaviorSettingsFormTest::createEntityBundleFormSubmit in Rabbit Hole 2.x
Same name and namespace in other branches
- 8 modules/rh_media/tests/src/Functional/MediaBehaviorSettingsFormTest.php \Drupal\Tests\rh_media\Functional\MediaBehaviorSettingsFormTest::createEntityBundleFormSubmit()
Creates new entity bundle via form submit.
Overrides RabbitHoleBehaviorSettingsFormTestBase::createEntityBundleFormSubmit
File
- modules/
rh_media/ tests/ src/ Functional/ MediaBehaviorSettingsFormTest.php, line 56
Class
- MediaBehaviorSettingsFormTest
- Test the functionality of the rabbit hole form additions to the media.
Namespace
Drupal\Tests\rh_media\FunctionalCode
protected function createEntityBundleFormSubmit($action, $override) {
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('/admin/structure/media/add');
$this
->assertRabbitHoleSettings();
$machine_name = mb_strtolower($this
->randomMachineName());
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->fieldExists('label')
->setValue($this
->randomString());
$this
->assertSession()
->fieldExists('id')
->setValue($machine_name);
$this
->assertSession()
->selectExists('source')
->selectOption('test');
$this
->assertSession()
->fieldExists('rh_action')
->setValue($action);
$this
->assertSession()
->fieldExists('rh_override')
->setValue($override);
$this
->assertSession()
->buttonExists('Save')
->press();
// To actually save the bundle we need to hit save again.
$this
->assertSession()
->buttonExists('Save')
->press();
$this->bundle = $this
->loadBundle($machine_name);
return $machine_name;
}