function UrlTest::testRenderAccess

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::testRenderAccess()
  2. 10 core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::testRenderAccess()

Tests the renderAccess() method.

@covers ::renderAccess @dataProvider accessProvider

Parameters

bool $access:

File

core/tests/Drupal/Tests/Core/UrlTest.php, line 533

Class

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

Namespace

Drupal\Tests\Core

Code

public function testRenderAccess($access) {
    $element = [
        '#url' => Url::fromRoute('entity.node.canonical', [
            'node' => 3,
        ]),
    ];
    $this->container
        ->set('current_user', $this->createMock('Drupal\\Core\\Session\\AccountInterface'));
    $this->container
        ->set('access_manager', $this->getMockAccessManager($access));
    $this->assertEquals($access, TestUrl::renderAccess($element));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.