public function WorkflowsFieldTest::testFieldType in Workflows Field 8
Same name and namespace in other branches
- 2.x tests/src/Kernel/WorkflowsFieldTest.php \Drupal\Tests\workflows_field\Kernel\WorkflowsFieldTest::testFieldType()
@covers \Drupal\workflows_field\Plugin\Field\FieldType\WorkflowsFieldItem
File
- tests/
src/ Kernel/ WorkflowsFieldTest.php, line 82
Class
- WorkflowsFieldTest
- Test the workflows field.
Namespace
Drupal\Tests\workflows_field\KernelCode
public function testFieldType() {
$node = Node::create([
'title' => 'Foo',
'type' => 'project',
'field_status' => 'in_discussion',
]);
$node
->save();
// Test the dependencies calculation.
$this
->assertEquals([
'config' => [
'workflows.workflow.bureaucracy_workflow',
],
], WorkflowsFieldItem::calculateStorageDependencies($node->field_status
->getFieldDefinition()
->getFieldStorageDefinition()));
// Test the getWorkflow method.
$this
->assertEquals('bureaucracy_workflow', $node->field_status[0]
->getWorkflow()
->id());
}