function ViewsAccessTest::testStaticAccessPlugin

Tests static access check.

File

tests/views_access.test, line 112

Class

ViewsAccessTest
Basic test for pluggable access.

Code

public function testStaticAccessPlugin() {
    $view = $this->view_access_static();
    $view->set_display('default');
    $access_plugin = $view->display_handler
        ->get_plugin('access');
    $this->assertFalse($access_plugin->access($this->normal_user));
    $access_plugin->options['access'] = TRUE;
    $this->assertTrue($access_plugin->access($this->normal_user));
    // FALSE comes from hook_menu caching.
    $expected_hook_menu = array(
        'views_test_test_static_access_callback',
        array(
            FALSE,
        ),
    );
    $hook_menu = $view->execute_hook_menu('page_1');
    $this->assertEqual($expected_hook_menu, $hook_menu['test_access_static']['access arguments'][0]);
    $expected_hook_menu = array(
        'views_test_test_static_access_callback',
        array(
            TRUE,
        ),
    );
    $this->assertTrue(views_access($expected_hook_menu));
}