function WorkflowAccessControlHandlerTest::testCheckAccess
Same name in other branches
- 8.9.x core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php \Drupal\Tests\workflows\Kernel\WorkflowAccessControlHandlerTest::testCheckAccess()
- 10 core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php \Drupal\Tests\workflows\Kernel\WorkflowAccessControlHandlerTest::testCheckAccess()
- 11.x core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php \Drupal\Tests\workflows\Kernel\WorkflowAccessControlHandlerTest::testCheckAccess()
@covers ::checkAccess @dataProvider checkAccessProvider
File
-
core/
modules/ workflows/ tests/ src/ Kernel/ WorkflowAccessControlHandlerTest.php, line 105
Class
- WorkflowAccessControlHandlerTest
- @coversDefaultClass \Drupal\workflows\WorkflowAccessControlHandler @group workflows
Namespace
Drupal\Tests\workflows\KernelCode
public function testCheckAccess($user, $operation, $result, $states_to_create = []) {
$workflow = Workflow::create([
'type' => 'workflow_type_test',
'id' => 'test_workflow',
]);
$workflow->save();
$workflow_type = $workflow->getTypePlugin();
foreach ($states_to_create as $state_id => $is_required) {
$workflow_type->addState($state_id, $this->randomString());
}
\Drupal::state()->set('workflow_type_test.required_states', array_filter($states_to_create));
$this->assertEquals($result, $this->accessControlHandler
->access($workflow, $operation, $this->{$user}, TRUE));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.