Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
848 florian 1
<?php
2
// $Id$
3
 
4
require_once 'simple_include.php';
5
require_once 'pager_include.php';
6
 
7
class TestOfPagerSlidingNotExpanded extends UnitTestCase {
8
    var $pager;
9
    function TestOfPagerSlidingNotExpanded($name='Test of Pager_Sliding - expanded=false') {
10
        $this->UnitTestCase($name);
11
    }
12
    function setUp() {
13
        $options = array(
14
            'itemData' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21),
15
            'perPage'  => 2,
16
            'mode'     => 'Sliding',
17
            'expanded' => false
18
        );
19
        $this->pager = new Pager($options);
20
    }
21
    function tearDown() {
22
        unset($this->pager);
23
    }
24
    function testPageRangeByPageId1() {
25
        $this->assertEqual(array(1, 3), $this->pager->getPageRangeByPageId(1));
26
    }
27
    function testPageRangeByPageId2() {
28
        $this->assertEqual(array(1, 4), $this->pager->getPageRangeByPageId(2));
29
    }
30
    function testPageRangeByPageId3() {
31
        $this->assertEqual(array(1, 5), $this->pager->getPageRangeByPageId(3));
32
    }
33
    function testPageRangeByPageId4() {
34
        $this->assertEqual(array(2, 6), $this->pager->getPageRangeByPageId(4));
35
    }
36
    function testPageRangeByPageId9() {
37
        $this->assertEqual(array(7, 11), $this->pager->getPageRangeByPageId(9));
38
    }
39
    function testPageRangeByPageId10() {
40
        $this->assertEqual(array(8, 11), $this->pager->getPageRangeByPageId(10));
41
    }
42
    function testPageRangeByPageId11() {
43
        $this->assertEqual(array(9, 11), $this->pager->getPageRangeByPageId(11));
44
    }
45
    function testPageRangeByPageId_outOfRange() {
46
        $this->assertEqual(array(0, 0), $this->pager->getPageRangeByPageId(20));
47
    }
48
}
49
?>