protected function NodeTest::createNodeType in Scheduled Publish 8.3
Same name and namespace in other branches
- 8.2 tests/src/Kernel/NodeTest.php \Drupal\Tests\scheduled_publish\Kernel\NodeTest::createNodeType()
Creates a page node type to test with, ensuring that it's moderated.
1 call to NodeTest::createNodeType()
- NodeTest::setUp in tests/
src/ Kernel/ NodeTest.php - Set the default field storage backend for fields created during tests.
File
- tests/
src/ Kernel/ NodeTest.php, line 64
Class
- NodeTest
- Class NodeTests
Namespace
Drupal\Tests\scheduled_publish\KernelCode
protected function createNodeType() {
$field_storage = FieldStorageConfig::create([
'field_name' => 'field_scheduled_publish',
'type' => 'scheduled_publish',
'entity_type' => 'node',
'cardinality' => -1,
]);
$field_storage
->save();
$node_type = NodeType::create([
'type' => 'page',
]);
$node_type
->save();
FieldConfig::create([
'entity_type' => 'node',
'field_name' => 'field_scheduled_publish',
'bundle' => 'page',
'label' => 'Test field',
])
->save();
$workflow = Workflow::load('editorial');
$workflow
->getTypePlugin()
->addEntityTypeAndBundle('node', 'page');
$workflow
->save();
}