public function WorkflowStateTransitionOperationsAccessCheckTest::testMissingRouteParams in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php \Drupal\Tests\workflows\Unit\WorkflowStateTransitionOperationsAccessCheckTest::testMissingRouteParams()
@covers ::access
File
- core/
modules/ workflows/ tests/ src/ Unit/ WorkflowStateTransitionOperationsAccessCheckTest.php, line 96
Class
- WorkflowStateTransitionOperationsAccessCheckTest
- @coversDefaultClass \Drupal\workflows\WorkflowStateTransitionOperationsAccessCheck @group workflows
Namespace
Drupal\Tests\workflows\UnitCode
public function testMissingRouteParams() {
$workflow = $this
->prophesize(WorkflowInterface::class);
$workflow
->access()
->shouldNotBeCalled();
$route = new Route('', [
'workflow' => NULL,
'workflow_state' => NULL,
], [
'_workflow_access' => 'update-state',
]);
$access_check = new WorkflowStateTransitionOperationsAccessCheck();
$account = $this
->prophesize(AccountInterface::class);
$missing_both = new RouteMatch(NULL, $route, []);
$this
->assertEquals(AccessResult::neutral(), $access_check
->access($missing_both, $account
->reveal()));
$missing_state = new RouteMatch(NULL, $route, [
'workflow' => $workflow
->reveal(),
]);
$this
->assertEquals(AccessResult::neutral(), $access_check
->access($missing_state, $account
->reveal()));
$missing_workflow = new RouteMatch(NULL, $route, [
'workflow_state' => 'foo',
]);
$this
->assertEquals(AccessResult::neutral(), $access_check
->access($missing_workflow, $account
->reveal()));
}