function UrlTest::getMockAccessManager
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::getMockAccessManager()
- 10 core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::getMockAccessManager()
- 11.x core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::getMockAccessManager()
Creates a mock access manager for the access tests.
Parameters
bool $access:
\Drupal\Core\Session\AccountInterface|null $account:
Return value
\Drupal\Core\Access\AccessManagerInterface|\PHPUnit\Framework\MockObject\MockObject
2 calls to UrlTest::getMockAccessManager()
- UrlTest::testAccessRouted in core/
tests/ Drupal/ Tests/ Core/ UrlTest.php - Tests the access() method for routed URLs.
- UrlTest::testRenderAccess in core/
tests/ Drupal/ Tests/ Core/ UrlTest.php - Tests the renderAccess() method.
File
-
core/
tests/ Drupal/ Tests/ Core/ UrlTest.php, line 843
Class
- UrlTest
- @coversDefaultClass \Drupal\Core\Url @group UrlTest
Namespace
Drupal\Tests\CoreCode
protected function getMockAccessManager($access, $account = NULL) {
$access_manager = $this->createMock('Drupal\\Core\\Access\\AccessManagerInterface');
$access_manager->expects($this->once())
->method('checkNamedRoute')
->with('entity.node.canonical', [
'node' => 3,
], $account)
->willReturn($access);
return $access_manager;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.