You are here

public function WorkflowStateTransitionOperationsAccessCheckTest::testInvalidOperationName in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php \Drupal\Tests\workflows\Unit\WorkflowStateTransitionOperationsAccessCheckTest::testInvalidOperationName()
  2. 9 core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php \Drupal\Tests\workflows\Unit\WorkflowStateTransitionOperationsAccessCheckTest::testInvalidOperationName()

@covers ::access @dataProvider invalidOperationNameTestCases

File

core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php, line 127

Class

WorkflowStateTransitionOperationsAccessCheckTest
@coversDefaultClass \Drupal\workflows\WorkflowStateTransitionOperationsAccessCheck @group workflows

Namespace

Drupal\Tests\workflows\Unit

Code

public function testInvalidOperationName($operation_name) {
  $this
    ->expectException(\Exception::class);
  $this
    ->expectExceptionMessage("Invalid _workflow_access operation '{$operation_name}' specified for route 'Foo Route'.");
  $route = new Route('', [], [
    '_workflow_access' => $operation_name,
  ]);
  $access_check = new WorkflowStateTransitionOperationsAccessCheck();
  $account = $this
    ->prophesize(AccountInterface::class);
  $access_check
    ->access(new RouteMatch('Foo Route', $route, []), $account
    ->reveal());
}