protected function UrlTest::getMockAccessManager in Drupal 8
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 - Contains \Drupal\Tests\Core\UrlTest.
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;
}