You are here

public function RendererTest::testRenderWithAccessControllerResolved in Drupal 8

Same name and namespace in other branches
  1. 9 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 583
Contains \Drupal\Tests\Core\Render\RendererTest.

Class

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

Namespace

Drupal\Tests\Core\Render

Code

public function testRenderWithAccessControllerResolved($access) {
  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);
}