1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of ViewsHandlerTestXss.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Tests the core views_handler_field_css handler.
|
10
|
*
|
11
|
* @see CommonXssUnitTest
|
12
|
*/
|
13
|
class ViewsHandlerTestXss extends ViewsSqlTest {
|
14
|
public static function getInfo() {
|
15
|
return array(
|
16
|
'name' => 'Field: Xss',
|
17
|
'description' => 'Test the core views_handler_field_css handler.',
|
18
|
'group' => 'Views Handlers',
|
19
|
);
|
20
|
}
|
21
|
|
22
|
function dataHelper() {
|
23
|
$map = array(
|
24
|
'John' => 'John',
|
25
|
"Foo\xC0barbaz" => '',
|
26
|
'Fooÿñ' => 'Fooÿñ',
|
27
|
);
|
28
|
|
29
|
return $map;
|
30
|
}
|
31
|
|
32
|
function viewsData() {
|
33
|
$data = parent::viewsData();
|
34
|
$data['views_test']['name']['field']['handler'] = 'views_handler_field_xss';
|
35
|
|
36
|
return $data;
|
37
|
}
|
38
|
|
39
|
public function testFieldXss() {
|
40
|
$view = $this->getBasicView();
|
41
|
|
42
|
$view->display['default']->handler->override_option('fields', array(
|
43
|
'name' => array(
|
44
|
'id' => 'name',
|
45
|
'table' => 'views_test',
|
46
|
'field' => 'name',
|
47
|
),
|
48
|
));
|
49
|
|
50
|
$this->executeView($view);
|
51
|
|
52
|
$counter = 0;
|
53
|
foreach ($this->dataHelper() as $input => $expected_result) {
|
54
|
$view->result[$counter]->views_test_name = $input;
|
55
|
$this->assertEqual($view->field['name']->advanced_render($view->result[$counter]), $expected_result);
|
56
|
$counter++;
|
57
|
}
|
58
|
}
|
59
|
|
60
|
}
|