1 |
6eb8d15f
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Contains ViewsHandlerTest.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Tests generic handler functionality.
|
10 |
|
|
*
|
11 |
|
|
* @see view
|
12 |
|
|
*/
|
13 |
|
|
class ViewsHandlerTest extends ViewsSqlTest {
|
14 |
|
|
|
15 |
|
|
public static function getInfo() {
|
16 |
|
|
return array(
|
17 |
|
|
'name' => 'Handlers',
|
18 |
|
|
'description' => 'Tests generic handler functionality.',
|
19 |
|
|
'group' => 'Views Handlers',
|
20 |
|
|
);
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
/**
|
24 |
|
|
* {@inheritdoc}
|
25 |
|
|
*/
|
26 |
|
|
protected function viewsData() {
|
27 |
|
|
$views_data = parent::viewsData();
|
28 |
|
|
$views_data['views']['test_access'] = array(
|
29 |
|
|
'title' => 'test access',
|
30 |
|
|
'help' => '',
|
31 |
|
|
'area' => array(
|
32 |
|
|
'handler' => 'views_test_area_access',
|
33 |
|
|
),
|
34 |
|
|
);
|
35 |
|
|
|
36 |
|
|
return $views_data;
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
/**
|
40 |
|
|
* Tests access for handlers using an area handler.
|
41 |
|
|
*/
|
42 |
|
|
public function testHandlerAccess() {
|
43 |
|
|
$view = $this->getBasicView();
|
44 |
|
|
|
45 |
|
|
// add a test area
|
46 |
|
|
$view->display['default']->handler->override_option('header', array(
|
47 |
|
|
'test_access' => array(
|
48 |
|
|
'id' => 'test_access',
|
49 |
|
|
'table' => 'views',
|
50 |
|
|
'field' => 'test_access',
|
51 |
|
|
'custom_access' => FALSE,
|
52 |
|
|
),
|
53 |
|
|
));
|
54 |
|
|
|
55 |
|
|
$view->init_display();
|
56 |
|
|
$view->init_handlers();
|
57 |
|
|
$handlers = $view->display_handler->get_handlers('header');
|
58 |
|
|
$this->assertEqual(0, count($handlers));
|
59 |
|
|
|
60 |
|
|
$view->destroy();
|
61 |
|
|
|
62 |
|
|
$view = $this->getBasicView();
|
63 |
|
|
|
64 |
|
|
// add a test area
|
65 |
|
|
$view->display['default']->handler->override_option('header', array(
|
66 |
|
|
'test_access' => array(
|
67 |
|
|
'id' => 'test_access',
|
68 |
|
|
'table' => 'views',
|
69 |
|
|
'field' => 'test_access',
|
70 |
|
|
'custom_access' => TRUE,
|
71 |
|
|
),
|
72 |
|
|
));
|
73 |
|
|
|
74 |
|
|
$view->init_display();
|
75 |
|
|
$view->init_handlers();
|
76 |
|
|
$handlers = $view->display_handler->get_handlers('header');
|
77 |
|
|
$this->assertEqual(1, count($handlers));
|
78 |
|
|
$this->assertTrue(isset($handlers['test_access']));
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
} |