You are here

public function ViewsAccessTest::testMissingAccessPlugin in Views (for Drupal 7) 7.3

Tests access for a view with a missing access plugin.

File

tests/views_access.test, line 167
Definition of ViewsAccessTest.

Class

ViewsAccessTest
Basic test for pluggable access.

Code

public function testMissingAccessPlugin() {
  $view = $this
    ->getMissingAccessPluginTestView();
  $view
    ->set_display('default');
  $access_plugin = $view->display_handler
    ->get_plugin('access');
  $this
    ->assertFalse($access_plugin);
  $this
    ->assertTrue($view->display_handler
    ->access($this->admin_user), t('Admin-Account should be able to access the view everytime'));
  $this
    ->assertTrue($view->display_handler
    ->access($this->web_user));
  $this
    ->assertTrue($view->display_handler
    ->access($this->normal_user));
  $hook_menu = $view
    ->execute_hook_menu('page_1');
  $this
    ->assertTrue($hook_menu['test_access_missing']['access arguments'][0]);
  $this
    ->assertTrue(views_access(TRUE));
}