public function WorkflowsFieldTest::testOptionsProvider in Workflows Field 8
Same name and namespace in other branches
- 2.x tests/src/Kernel/WorkflowsFieldTest.php \Drupal\Tests\workflows_field\Kernel\WorkflowsFieldTest::testOptionsProvider()
Test the implementation of OptionsProviderInterface.
File
- tests/
src/ Kernel/ WorkflowsFieldTest.php, line 19
Class
- WorkflowsFieldTest
- Test the workflows field.
Namespace
Drupal\Tests\workflows_field\KernelCode
public function testOptionsProvider() {
$node = Node::create([
'title' => 'Foo',
'type' => 'project',
'field_status' => 'in_discussion',
]);
$node
->save();
$this
->assertEquals([
'implementing' => 'Implementing',
'approved' => 'Approved',
'rejected' => 'Rejected',
'planning' => 'Planning',
'in_discussion' => 'In Discussion',
], $node->field_status[0]
->getPossibleOptions());
$this
->assertEquals([
'approved' => 'Approved',
'rejected' => 'Rejected',
'in_discussion' => 'In Discussion',
], $node->field_status[0]
->getSettableOptions());
$this
->assertEquals([
'implementing',
'approved',
'rejected',
'planning',
'in_discussion',
], $node->field_status[0]
->getPossibleValues());
$this
->assertEquals([
'approved',
'rejected',
'in_discussion',
], $node->field_status[0]
->getSettableValues());
}