Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed May 7, 2013
1 parent 06e7ba6 commit 3720897
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
Expand Up @@ -570,7 +570,7 @@ public function testPaginateExtraParams() {
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();

Expand Down Expand Up @@ -1083,7 +1083,7 @@ public function testPaginateMaxLimit() {
$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(
Expand Down Expand Up @@ -1134,13 +1134,26 @@ public function testPaginateOrderVirtualFieldSharedWithRealField() {
), false);

$Controller->paginate = array(
'fields' => array('PaginatorControllerComment.id', 'title', 'PaginatorControllerPost.title'),
'fields' => array(
'PaginatorControllerComment.id',
'title',
'PaginatorControllerPost.title'
),
);
$Controller->request->params['named'] = array(
'sort' => 'PaginatorControllerPost.title',
'direction' => 'desc'
);
$Controller->passedArgs = array('sort' => 'PaginatorControllerPost.title', 'dir' => 'asc');
$result = $Controller->paginate('PaginatorControllerComment');
$result = Hash::extract($result, '{n}.PaginatorControllerComment.id');
$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);
}

/**
Expand Down

0 comments on commit 3720897

Please sign in to comment.