mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fix test
This commit is contained in:
parent
06e7ba66c9
commit
372089797f
1 changed files with 20 additions and 7 deletions
|
@ -570,7 +570,7 @@ class PaginatorComponentTest extends CakeTestCase {
|
||||||
public function testPaginateSpecialType() {
|
public function testPaginateSpecialType() {
|
||||||
$Controller = new PaginatorTestController($this->request);
|
$Controller = new PaginatorTestController($this->request);
|
||||||
$Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment');
|
$Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment');
|
||||||
$Controller->passedArgs[] = '1';
|
$Controller->request->params['pass'][] = '1';
|
||||||
$Controller->params['url'] = array();
|
$Controller->params['url'] = array();
|
||||||
$Controller->constructClasses();
|
$Controller->constructClasses();
|
||||||
|
|
||||||
|
@ -1083,7 +1083,7 @@ class PaginatorComponentTest extends CakeTestCase {
|
||||||
$Controller = new Controller($this->request);
|
$Controller = new Controller($this->request);
|
||||||
|
|
||||||
$Controller->uses = array('PaginatorControllerPost', 'ControllerComment');
|
$Controller->uses = array('PaginatorControllerPost', 'ControllerComment');
|
||||||
$Controller->passedArgs[] = '1';
|
$Controller->request->params['pass'][] = '1';
|
||||||
$Controller->constructClasses();
|
$Controller->constructClasses();
|
||||||
|
|
||||||
$Controller->request->params['named'] = array(
|
$Controller->request->params['named'] = array(
|
||||||
|
@ -1134,13 +1134,26 @@ class PaginatorComponentTest extends CakeTestCase {
|
||||||
), false);
|
), false);
|
||||||
|
|
||||||
$Controller->paginate = array(
|
$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');
|
$Controller->request->params['named'] = array(
|
||||||
$result = $Controller->paginate('PaginatorControllerComment');
|
'sort' => 'PaginatorControllerPost.title',
|
||||||
$result = Hash::extract($result, '{n}.PaginatorControllerComment.id');
|
'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);
|
sort($result);
|
||||||
$this->assertEquals(array(1, 2, 3, 4, 5, 6), $result);
|
$this->assertEquals(array(1, 2, 3, 4), $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue