function RendererTest::testRenderWithAccessControllerResolved

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderWithAccessControllerResolved()
  2. 8.9.x core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderWithAccessControllerResolved()
  3. 11.x core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderWithAccessControllerResolved()

@covers ::render @covers ::doRender

@dataProvider providerAccessValues

File

core/tests/Drupal/Tests/Core/Render/RendererTest.php, line 601

Class

RendererTest
@coversDefaultClass \Drupal\Core\Render\Renderer @group Render

Namespace

Drupal\Tests\Core\Render

Code

public function testRenderWithAccessControllerResolved($access) : void {
    switch ($access) {
        case AccessResult::allowed():
            $method = 'accessResultAllowed';
            break;
        case AccessResult::forbidden():
            $method = 'accessResultForbidden';
            break;
        case FALSE:
            $method = 'accessFalse';
            break;
        case TRUE:
            $method = 'accessTrue';
            break;
    }
    $build = [
        '#access_callback' => 'Drupal\\Tests\\Core\\Render\\TestAccessClass::' . $method,
    ];
    $this->assertAccess($build, $access);
}

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