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

  1. <?php
  2. // $Id: pager_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 TestOfPager extends UnitTestCase {
  8.     var $pager;
  9.     function TestOfPager($name='Test of Pager') {
  10.         $this->UnitTestCase($name);
  11.     }
  12.     function setUp() {
  13.         $options = array(
  14.             'itemData'    => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
  15.             'perPage' => 5,
  16.  
  17.         );
  18.         $this->pager = new Pager($options);
  19.     }
  20.     function tearDown() {
  21.         unset($this->pager);
  22.     }
  23.     function testCurrentPageID () {
  24.         $this->assertEqual(1, $this->pager->getCurrentPageID());
  25.     }
  26.     function testNextPageID () {
  27.         $this->assertEqual(2, $this->pager->getNextPageID());
  28.     }
  29.     function testPrevPageID () {
  30.         $this->assertEqual(false, $this->pager->getPreviousPageID());
  31.     }
  32.     function testNumItems () {
  33.         $this->assertEqual(10, $this->pager->numItems());
  34.     }
  35.     function testNumPages () {
  36.         $this->assertEqual(2, $this->pager->numPages());
  37.     }
  38.     function testFirstPage () {
  39.         $this->assertEqual(true, $this->pager->isFirstPage());
  40.     }
  41.     function testLastPage () {
  42.         $this->assertEqual(false, $this->pager->isLastPage());
  43.     }
  44.     function testLastPageComplete () {
  45.         $this->assertEqual(true, $this->pager->isLastPageComplete());
  46.     }
  47.     function testOffsetByPageId1() {
  48.         $this->assertEqual(array(1, 5), $this->pager->getOffsetByPageId(1));
  49.     }
  50.     function testOffsetByPageId2() {
  51.         $this->assertEqual(array(6, 10), $this->pager->getOffsetByPageId(2));
  52.     }
  53.     function testOffsetByPageId_outOfRange() {
  54.         $this->assertEqual(array(0, 0), $this->pager->getOffsetByPageId(20));
  55.     }
  56. }
  57. ?>