public function ViewsHandlerTest::testHandlerAccess in Views (for Drupal 7) 7.3
Tests access for handlers using an area handler.
File
- tests/
handlers/ views_handlers.test, line 42 - Definition of ViewsHandlerTest.
Class
- ViewsHandlerTest
- Tests generic handler functionality.
Code
public function testHandlerAccess() {
$view = $this
->getBasicView();
// add a test area.
$view->display['default']->handler
->override_option('header', array(
'test_access' => array(
'id' => 'test_access',
'table' => 'views',
'field' => 'test_access',
'custom_access' => FALSE,
),
));
$view
->init_display();
$view
->init_handlers();
$handlers = $view->display_handler
->get_handlers('header');
$this
->assertEqual(0, count($handlers));
$view
->destroy();
$view = $this
->getBasicView();
// add a test area.
$view->display['default']->handler
->override_option('header', array(
'test_access' => array(
'id' => 'test_access',
'table' => 'views',
'field' => 'test_access',
'custom_access' => TRUE,
),
));
$view
->init_display();
$view
->init_handlers();
$handlers = $view->display_handler
->get_handlers('header');
$this
->assertEqual(1, count($handlers));
$this
->assertTrue(isset($handlers['test_access']));
}