function WorkflowAccessControlHandlerTest::testCheckCreateAccess
@covers ::checkCreateAccess
      
    
File
- 
              core/
modules/ workflows/ tests/ src/ Kernel/ WorkflowAccessControlHandlerTest.php, line 75  
Class
- WorkflowAccessControlHandlerTest
 - @coversDefaultClass \Drupal\workflows\WorkflowAccessControlHandler[[api-linebreak]] @group workflows @group #slow
 
Namespace
Drupal\Tests\workflows\KernelCode
public function testCheckCreateAccess() : void {
  // A user must have the correct permission to create a workflow.
  $this->assertEquals(AccessResult::neutral()->addCacheContexts([
    'user.permissions',
  ])
    ->setReason("The 'administer workflows' permission is required."), $this->accessControlHandler
    ->createAccess(NULL, $this->user, [], TRUE));
  $this->assertEquals(AccessResult::allowed()->addCacheContexts([
    'user.permissions',
  ]), $this->accessControlHandler
    ->createAccess(NULL, $this->adminUser, [], TRUE));
  // Remove all plugin types and ensure not even the admin user is allowed to
  // create a workflow.
  workflow_type_test_set_definitions([]);
  $this->accessControlHandler
    ->resetCache();
  $this->assertEquals(AccessResult::neutral()->addCacheContexts([
    'user.permissions',
  ]), $this->accessControlHandler
    ->createAccess(NULL, $this->adminUser, [], TRUE));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.