You are here

public function AccessPermissionTest::testAccessPerm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/tests/src/Kernel/Views/AccessPermissionTest.php \Drupal\Tests\user\Kernel\Views\AccessPermissionTest::testAccessPerm()
  2. 10 core/modules/user/tests/src/Kernel/Views/AccessPermissionTest.php \Drupal\Tests\user\Kernel\Views\AccessPermissionTest::testAccessPerm()

Tests perm access plugin.

File

core/modules/user/tests/src/Kernel/Views/AccessPermissionTest.php, line 74

Class

AccessPermissionTest
Tests views perm access plugin.

Namespace

Drupal\Tests\user\Kernel\Views

Code

public function testAccessPerm() {
  $view = Views::getView('test_access_perm');
  $view
    ->setDisplay();
  $access_plugin = $view->display_handler
    ->getPlugin('access');
  $this
    ->assertInstanceOf(Permission::class, $access_plugin);
  $this
    ->assertEquals('Permission', $access_plugin
    ->pluginTitle());
  $this
    ->assertFalse($view->display_handler
    ->access($this->webUser));
  $this
    ->assertTrue($view->display_handler
    ->access($this->normalUser));
}