function WorkflowStateTransitionOperationsAccessCheckTest::testInvalidOperationName

Tests invalid operation name.

@legacy-covers ::access

Attributes

#[DataProvider('invalidOperationNameTestCases')]

File

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

Class

WorkflowStateTransitionOperationsAccessCheckTest
Tests Drupal\workflows\WorkflowStateTransitionOperationsAccessCheck.

Namespace

Drupal\Tests\workflows\Unit

Code

public function testInvalidOperationName($operation_name) : void {
  $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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.