You are here

protected function NodeBehaviorSettingsFormTest::createEntity 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::createEntity()

Creates new entity.

Parameters

string $action: Rabbit Hole action.

Return value

int ID of the created entity.

Overrides RabbitHoleBehaviorSettingsFormTestBase::createEntity

File

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

Class

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

Namespace

Drupal\Tests\rh_node\Functional

Code

protected function createEntity($action = NULL) {
  $values = [
    'type' => $this->bundle
      ->id(),
    'title' => $this
      ->randomString(),
  ];
  if (isset($action)) {
    $values['rh_action'] = $action;
  }
  return $this
    ->drupalCreateNode($values)
    ->id();
}