function WorkflowStateTransitionOperationsAccessCheckTest::testAccess
Same name in other branches
- 9 core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php \Drupal\Tests\workflows\Unit\WorkflowStateTransitionOperationsAccessCheckTest::testAccess()
- 8.9.x core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php \Drupal\Tests\workflows\Unit\WorkflowStateTransitionOperationsAccessCheckTest::testAccess()
- 11.x core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php \Drupal\Tests\workflows\Unit\WorkflowStateTransitionOperationsAccessCheckTest::testAccess()
Tests the access method correctly proxies to the entity access system.
@covers ::access @dataProvider accessTestCases
File
-
core/
modules/ workflows/ tests/ src/ Unit/ WorkflowStateTransitionOperationsAccessCheckTest.php, line 28
Class
- WorkflowStateTransitionOperationsAccessCheckTest
- @coversDefaultClass \Drupal\workflows\WorkflowStateTransitionOperationsAccessCheck @group workflows
Namespace
Drupal\Tests\workflows\UnitCode
public function testAccess($route_requirement, $resulting_entity_access_check, $route_parameters = []) : void {
$workflow_entity_access_result = AccessResult::allowed();
$workflow = $this->prophesize(WorkflowInterface::class);
$workflow->access($resulting_entity_access_check, Argument::type(AccountInterface::class), TRUE)
->shouldBeCalled()
->willReturn($workflow_entity_access_result);
$route = new Route('', [
'workflow' => NULL,
'workflow_transition' => NULL,
'workflow_state' => NULL,
], [
'_workflow_access' => $route_requirement,
]);
$route_match_params = [
'workflow' => $workflow->reveal(),
] + $route_parameters;
$route_match = new RouteMatch(NULL, $route, $route_match_params);
$access_check = new WorkflowStateTransitionOperationsAccessCheck();
$account = $this->prophesize(AccountInterface::class);
$this->assertEquals($workflow_entity_access_result, $access_check->access($route_match, $account->reveal()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.