function ActiveWorkspaceCheckTest::testAccess
Same name in other branches
- 9 core/modules/workspaces/tests/src/Unit/ActiveWorkspaceCheckTest.php \Drupal\Tests\workspaces\Unit\ActiveWorkspaceCheckTest::testAccess()
- 8.9.x core/modules/workspaces/tests/src/Unit/ActiveWorkspaceCheckTest.php \Drupal\Tests\workspaces\Unit\ActiveWorkspaceCheckTest::testAccess()
- 11.x core/modules/workspaces/tests/src/Unit/ActiveWorkspaceCheckTest.php \Drupal\Tests\workspaces\Unit\ActiveWorkspaceCheckTest::testAccess()
@covers ::access @dataProvider providerTestAccess
File
-
core/
modules/ workspaces/ tests/ src/ Unit/ ActiveWorkspaceCheckTest.php, line 64
Class
- ActiveWorkspaceCheckTest
- @coversDefaultClass \Drupal\workspaces\Access\ActiveWorkspaceCheck
Namespace
Drupal\Tests\workspaces\UnitCode
public function testAccess($requirements, $has_active_workspace, $access, array $contexts = []) : void {
$route = new Route('', [], $requirements);
$workspace_manager = $this->prophesize(WorkspaceManagerInterface::class);
$workspace_manager->hasActiveWorkspace()
->willReturn($has_active_workspace);
$access_check = new ActiveWorkspaceCheck($workspace_manager->reveal());
$access_result = AccessResult::allowedIf($access)->addCacheContexts($contexts);
$this->assertEquals($access_result, $access_check->access($route));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.