home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / pager_sliding_notExpanded_test.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  1.7 KB  |  49 lines

  1. <?php
  2. // $Id: pager_sliding_notExpanded_test.php,v 1.4 2003/11/17 20:08:08 quipo Exp $
  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. ?>