function AccessPermissionTest::testAccessPerm

Tests perm access plugin.

File

drupal/core/modules/user/lib/Drupal/user/Tests/Views/AccessPermissionTest.php, line 37
Contains \Drupal\user\Tests\Views\AccessPermissionTest.

Class

AccessPermissionTest
Tests views perm access plugin.

Namespace

Drupal\user\Tests\Views

Code

function testAccessPerm() {
  $view = views_get_view('test_access_perm');
  $view
    ->setDisplay();
  $access_plugin = $view->display_handler
    ->getPlugin('access');
  $this
    ->assertTrue($access_plugin instanceof Permission, 'Make sure the right class got instantiated.');
  $this
    ->assertTrue($view->display_handler
    ->access($this->adminUser), t('Admin-Account should be able to access the view everytime'));
  $this
    ->assertFalse($view->display_handler
    ->access($this->webUser));
  $this
    ->assertTrue($view->display_handler
    ->access($this->normalUser));
}