Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
848 florian 1
<?php
2
// $Id$
3
 
4
//override url
5
$_SERVER['PHP_SELF'] = '">test';
6
 
7
require_once 'simple_include.php';
8
require_once 'pager_include.php';
9
 
10
class TestOfPagerXSS extends UnitTestCase {
11
    var $pager;
12
    var $baseurl;
13
    function TestOfPagerXSS($name='Test of Pager - XSS attacks') {
14
        $this->UnitTestCase($name);
15
    }
16
    function setUp() {
17
        $options = array(
18
            'itemData' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
19
            'perPage'  => 5,
20
        );
21
        $this->pager = Pager::factory($options);
22
        $this->baseurl = substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'));
23
    }
24
    function tearDown() {
25
        unset($this->pager);
26
    }
27
    function testXSS() {
28
        $options = array(
29
            'itemData' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
30
            'perPage'  => 5,
31
            'nextImg'  => '&raquo;'
32
        );
33
        $this->pager = Pager::factory($options);
34
        $expected = '&nbsp;<a href="./&quot;&gt;test?pageID=2" title="next page">&raquo;</a>&nbsp;';
35
        $this->assertEqual($expected, $this->pager->_getNextLink());
36
    }
37
}
38
if (!defined('TEST_RUNNING')) {
39
    define('TEST_RUNNING', true);
40
    $test = &new TestOfPagerXSS();
41
    $test->run(new HtmlReporter());
42
}
43
?>