You are here

protected function NodeBehaviorSettingsFormTest::createEntityBundleFormSubmit in Rabbit Hole 2.x

Same name and namespace in other branches
  1. 8 modules/rh_node/tests/src/Functional/NodeBehaviorSettingsFormTest.php \Drupal\Tests\rh_node\Functional\NodeBehaviorSettingsFormTest::createEntityBundleFormSubmit()

Creates new entity bundle via form submit.

Overrides RabbitHoleBehaviorSettingsFormTestBase::createEntityBundleFormSubmit

File

modules/rh_node/tests/src/Functional/NodeBehaviorSettingsFormTest.php, line 71

Class

NodeBehaviorSettingsFormTest
Test the functionality of the rabbit hole form additions to the node form.

Namespace

Drupal\Tests\rh_node\Functional

Code

protected function createEntityBundleFormSubmit($action, $override) {
  $this
    ->drupalLogin($this->adminUser);
  $edit = [
    'name' => $this
      ->randomString(),
    'type' => mb_strtolower($this
      ->randomMachineName()),
    'rh_action' => $action,
    'rh_override' => $override,
  ];
  $this
    ->drupalGet(Url::fromRoute('node.type_add'));
  $this
    ->assertRabbitHoleSettings();
  $button_label = \Drupal::moduleHandler()
    ->moduleExists('field_ui') ? 'Save and manage fields' : 'Save content type';
  $this
    ->submitForm($edit, $button_label);
  $this->bundle = $this
    ->loadBundle($edit['type']);
  return $edit['type'];
}