You are here

protected function UrlTest::getMockAccessManager in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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 796
Contains \Drupal\Tests\Core\UrlTest.

Class

UrlTest
@coversDefaultClass \Drupal\Core\Url @group UrlTest

Namespace

Drupal\Tests\Core

Code

protected function getMockAccessManager($access, $account = NULL) {
  $access_manager = $this
    ->getMock('Drupal\\Core\\Access\\AccessManagerInterface');
  $access_manager
    ->expects($this
    ->once())
    ->method('checkNamedRoute')
    ->with('entity.node.canonical', [
    'node' => 3,
  ], $account)
    ->willReturn($access);
  return $access_manager;
}