mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding more tests to paginator using admin route
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6634 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a138ae3d63
commit
33a3a27fd1
1 changed files with 13 additions and 7 deletions
|
@ -35,7 +35,6 @@ uses('view'.DS.'helpers'.DS.'app_helper', 'view'.DS.'helper', 'view'.DS.'helpers
|
|||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
*/
|
||||
class PaginatorTest extends UnitTestCase {
|
||||
|
||||
function setUp() {
|
||||
$this->Paginator = new PaginatorHelper();
|
||||
$this->Paginator->params['paging'] = array(
|
||||
|
@ -93,7 +92,6 @@ class PaginatorTest extends UnitTestCase {
|
|||
$result = $this->Paginator->prev('prev', array('update'=> 'theList', 'indicator'=> 'loading', 'url'=> array('controller' => 'posts')), null, array('class' => 'disabled'));
|
||||
$expected = '<div class="disabled">prev</div>';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
}
|
||||
|
||||
function testSortLinks() {
|
||||
|
@ -126,8 +124,20 @@ class PaginatorTest extends UnitTestCase {
|
|||
}
|
||||
|
||||
function testSortAdminLinks() {
|
||||
Router::reload();
|
||||
Configure::write('Routing.admin', 'admin');
|
||||
|
||||
Router::reload();
|
||||
Router::setRequestInfo(array(
|
||||
array('pass' => array(), 'named' => array(), 'controller' => 'users', 'plugin' => null, 'action' => 'admin_index', 'prefix' => 'admin', 'admin' => true, 'url' => array('ext' => 'html', 'url' => 'admin/users'), 'form' => array()),
|
||||
array('base' => '', 'here' => '/admin/users', 'webroot' => '/')
|
||||
));
|
||||
Router::parse('/admin/users');
|
||||
$this->Paginator->params['paging']['Article']['page'] = 1;
|
||||
$result = $this->Paginator->next('Next');
|
||||
$this->assertPattern('/^<a[^<>]+>Next<\/a>$/', $result);
|
||||
$this->assertPattern('/href="\/admin\/users\/index\/page:2"/', $result);
|
||||
|
||||
Router::reload();
|
||||
Router::setRequestInfo(array(
|
||||
array('plugin' => null, 'controller' => 'test', 'action' => 'admin_index', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/test')),
|
||||
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/test', 'webroot' => '/')
|
||||
|
@ -281,7 +291,6 @@ class PaginatorTest extends UnitTestCase {
|
|||
}
|
||||
|
||||
function testFirstAndLast() {
|
||||
|
||||
$this->Paginator->params['paging'] = array('Client' => array(
|
||||
'page' => 1, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
|
||||
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
|
||||
|
@ -292,7 +301,6 @@ class PaginatorTest extends UnitTestCase {
|
|||
$expected = '';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$this->Paginator->params['paging'] = array('Client' => array(
|
||||
'page' => 4, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
|
||||
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
|
||||
|
@ -303,7 +311,6 @@ class PaginatorTest extends UnitTestCase {
|
|||
$expected = '<span><a href="/index/page:1"><< first</a></span>';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$result = $this->Paginator->last();
|
||||
$expected = '<span><a href="/index/page:15">last >></a></span>';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
@ -330,6 +337,5 @@ class PaginatorTest extends UnitTestCase {
|
|||
function tearDown() {
|
||||
unset($this->Paginator);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue