protected function EntityStateChangeValidationTest::createExampleModeratedContentType in Workbench Moderation 8
Create an example content type.
Parameters
string $default_state: The default state.
array $allowed_states: The allowed states.
2 calls to EntityStateChangeValidationTest::createExampleModeratedContentType()
- EntityStateChangeValidationTest::testTransitionAccessValidationNewEntity in tests/
src/ Kernel/ EntityStateChangeValidationTest.php - Test transistion access validation on new entity creation.
- EntityStateChangeValidationTest::testTransitionAccessValidationSavedEntity in tests/
src/ Kernel/ EntityStateChangeValidationTest.php - Test transition access validation on entity save.
File
- tests/
src/ Kernel/ EntityStateChangeValidationTest.php, line 304
Class
- EntityStateChangeValidationTest
- @coversDefaultClass \Drupal\workbench_moderation\Plugin\Validation\Constraint\ModerationStateValidator @group workbench_moderation
Namespace
Drupal\Tests\workbench_moderation\KernelCode
protected function createExampleModeratedContentType($default_state, array $allowed_states) {
$node_type = NodeType::create([
'type' => 'example',
]);
$node_type
->save();
$node_type = NodeType::load('example');
$node_type
->setThirdPartySetting('workbench_moderation', 'enabled', TRUE);
$node_type
->setThirdPartySetting('workbench_moderation', 'allowed_moderation_states', $allowed_states);
$node_type
->setThirdPartySetting('workbench_moderation', 'default_moderation_state', $default_state);
$node_type
->save();
}