NodeBehaviorInvocationTest.php in Rabbit Hole 2.x
File
modules/rh_node/tests/src/Functional/NodeBehaviorInvocationTest.php
View source
<?php
namespace Drupal\Tests\rh_node\Functional;
use Drupal\Tests\rabbit_hole\Functional\RabbitHoleBehaviorInvocationTestBase;
class NodeBehaviorInvocationTest extends RabbitHoleBehaviorInvocationTestBase {
protected $entityType = 'node';
public static $modules = [
'rh_node',
'node',
];
const TEST_BUNDLE = 'rh_node_test_content_type';
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();
}
protected function createEntity($action = NULL) {
$values = [
'type' => self::TEST_BUNDLE,
];
if (isset($action)) {
$values['rh_action'] = $action;
}
return $this
->drupalCreateNode($values);
}
}