/** * Class Constructor. * * @since 1.0 * @access public * @param int The total number of records. * @param int The number of items shown. * @param int The number of items to be shown per page. */ public function __construct($total, $limitstart, $limit) { // Initialize the original pagination from Joomla. $this->pagination = new JPagination($total, $limitstart, $limit); if (!FD::isJoomla30()) { $this->pagination->pagesCurrent = $this->pagination->get('pages.current'); $this->pagination->pagesTotal = $this->pagination->get('pages.total'); $this->pagination->pagesStart = $this->pagination->get('pages.start'); $this->pagination->pagesStop = $this->pagination->get('pages.stop'); } }
/** * This method tests the. * * This is a basic data driven test. It takes the data passed, runs the constructor * and make sure the appropriate values get setup. * * @return void * * @since 11.1 * @dataProvider dataTestConstructor * @covers JPagination::__construct */ public function testConstructor($total, $limitstart, $limit, $expected) { $pagination = new JPagination($total, $limitstart, $limit); $this->assertEquals($expected['total'], $pagination->total, 'Wrong Total'); $this->assertEquals($expected['limitstart'], $pagination->limitstart, 'Wrong Limitstart'); $this->assertEquals($expected['limit'], $pagination->limit, 'Wrong Limit'); $this->assertEquals($expected['pages.total'], $pagination->get('pages.total'), 'Wrong Total Pages'); $this->assertEquals($expected['pages.current'], $pagination->get('pages.current'), 'Wrong Current Page'); $this->assertEquals($expected['pages.start'], $pagination->get('pages.start'), 'Wrong Start Page'); $this->assertEquals($expected['pages.stop'], $pagination->get('pages.stop'), 'Wrong Stop Page'); unset($pagination); }
/** * This method tests the get method. * * @param integer $property The property to get. * @param string $default The default value if the property doesn't exist * @param array $expected The expected results for the JPagination object * * @return void * * @covers JPagination::get * @dataProvider dataGet * @since 3.2 */ public function testGet($property, $default, $expected) { $pagination = new JPagination(100, 50, 20, '', $this->app); $result = $pagination->get($property, $default); $this->assertEquals($result, $expected, 'The expected output of the property is incorrect'); unset($pagination); }