function AccessPermissionTest::testAccessPerm

Same name in other branches
  1. 9 core/modules/user/tests/src/Kernel/Views/AccessPermissionTest.php \Drupal\Tests\user\Kernel\Views\AccessPermissionTest::testAccessPerm()
  2. 8.9.x core/modules/user/tests/src/Kernel/Views/AccessPermissionTest.php \Drupal\Tests\user\Kernel\Views\AccessPermissionTest::testAccessPerm()
  3. 11.x 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 75

Class

AccessPermissionTest
Tests views perm access plugin.

Namespace

Drupal\Tests\user\Kernel\Views

Code

public function testAccessPerm() : void {
    $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));
}

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