From 372089797f333ec23d5c541d6791e93651c05f99 Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 7 May 2013 23:23:07 +0530 Subject: [PATCH] Fix test --- .../Component/PaginatorComponentTest.php | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php index e4e72a469..06f0b7595 100644 --- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php @@ -570,7 +570,7 @@ class PaginatorComponentTest extends CakeTestCase { public function testPaginateSpecialType() { $Controller = new PaginatorTestController($this->request); $Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment'); - $Controller->passedArgs[] = '1'; + $Controller->request->params['pass'][] = '1'; $Controller->params['url'] = array(); $Controller->constructClasses(); @@ -1083,7 +1083,7 @@ class PaginatorComponentTest extends CakeTestCase { $Controller = new Controller($this->request); $Controller->uses = array('PaginatorControllerPost', 'ControllerComment'); - $Controller->passedArgs[] = '1'; + $Controller->request->params['pass'][] = '1'; $Controller->constructClasses(); $Controller->request->params['named'] = array( @@ -1134,13 +1134,26 @@ class PaginatorComponentTest extends CakeTestCase { ), false); $Controller->paginate = array( - 'fields' => array('PaginatorControllerComment.id', 'title', 'PaginatorControllerPost.title'), + 'fields' => array( + 'PaginatorControllerComment.id', + 'title', + 'PaginatorControllerPost.title' + ), ); - $Controller->passedArgs = array('sort' => 'PaginatorControllerPost.title', 'dir' => 'asc'); - $result = $Controller->paginate('PaginatorControllerComment'); - $result = Hash::extract($result, '{n}.PaginatorControllerComment.id'); + $Controller->request->params['named'] = array( + 'sort' => 'PaginatorControllerPost.title', + 'direction' => 'desc' + ); + $result = Hash::extract( + $Controller->paginate('PaginatorControllerComment'), + '{n}.PaginatorControllerComment.id' + ); + $result1 = array_splice($result, 0, 2); + sort($result1); + $this->assertEquals(array(5, 6), $result1); + sort($result); - $this->assertEquals(array(1, 2, 3, 4, 5, 6), $result); + $this->assertEquals(array(1, 2, 3, 4), $result); } /**