You are here

protected function NodeBehaviorInvocationTest::createEntityBundle in Rabbit Hole 2.x

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

Creates new entity bundle.

Parameters

string $action: Rabbit Hole action.

Return value

string ID of the created bundle.

Overrides RabbitHoleBehaviorInvocationTestBase::createEntityBundle

File

modules/rh_node/tests/src/Functional/NodeBehaviorInvocationTest.php, line 29

Class

NodeBehaviorInvocationTest
Test that rabbit hole behaviors are invoked correctly for nodes.

Namespace

Drupal\Tests\rh_node\Functional

Code

protected function createEntityBundle($action = NULL) {
  $bundle = $this
    ->drupalCreateContentType([
    'type' => self::TEST_BUNDLE,
  ]);
  if (isset($action)) {
    $this->behaviorSettingsManager
      ->saveBehaviorSettings([
      'action' => $action,
      'allow_override' => TRUE,
    ], 'node_type', $bundle
      ->id());
  }
  return $bundle
    ->id();
}