|
|
@@ -111,7 +111,10 @@ trait PaginatorTestTrait
|
|
|
'order' => ['PaginatorPosts.id' => 'ASC'],
|
|
|
'page' => 1,
|
|
|
]);
|
|
|
- $this->Paginator->paginate($table, $params, $settings);
|
|
|
+
|
|
|
+ $this->deprecated(function () use ($table, $params, $settings) {
|
|
|
+ $this->Paginator->paginate($table, $params, $settings);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -272,7 +275,10 @@ trait PaginatorTestTrait
|
|
|
];
|
|
|
$defaults = $this->Paginator->getDefaults('Silly', $settings);
|
|
|
$result = $this->Paginator->mergeOptions([], $defaults);
|
|
|
- $this->assertEquals($settings, $result);
|
|
|
+ $this->assertEquals($settings + [
|
|
|
+ 'sortableFields' => null,
|
|
|
+ 'finder' => 'all',
|
|
|
+ ], $result);
|
|
|
|
|
|
$defaults = $this->Paginator->getDefaults('Posts', $settings);
|
|
|
$result = $this->Paginator->mergeOptions([], $defaults);
|
|
|
@@ -281,6 +287,8 @@ trait PaginatorTestTrait
|
|
|
'limit' => 10,
|
|
|
'maxLimit' => 50,
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
+ 'sortableFields' => null,
|
|
|
+ 'finder' => 'all',
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
@@ -313,6 +321,7 @@ trait PaginatorTestTrait
|
|
|
'maxLimit' => 100,
|
|
|
'finder' => 'myCustomFind',
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
+ 'sortableFields' => null,
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
@@ -332,6 +341,7 @@ trait PaginatorTestTrait
|
|
|
'finder' => 'myCustomFind',
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
'scope' => 'nonexistent',
|
|
|
+ 'sortableFields' => null,
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
@@ -351,6 +361,7 @@ trait PaginatorTestTrait
|
|
|
'finder' => 'myCustomFind',
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
'scope' => 'scope',
|
|
|
+ 'sortableFields' => null,
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
@@ -378,6 +389,7 @@ trait PaginatorTestTrait
|
|
|
'maxLimit' => 100,
|
|
|
'finder' => 'myCustomFind',
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
+ 'sortableFields' => null,
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
@@ -403,6 +415,8 @@ trait PaginatorTestTrait
|
|
|
'limit' => 75,
|
|
|
'maxLimit' => 100,
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
+ 'sortableFields' => null,
|
|
|
+ 'finder' => 'all',
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
@@ -432,6 +446,8 @@ trait PaginatorTestTrait
|
|
|
'limit' => 10,
|
|
|
'maxLimit' => 100,
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
+ 'sortableFields' => null,
|
|
|
+ 'finder' => 'all',
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
@@ -454,6 +470,7 @@ trait PaginatorTestTrait
|
|
|
'limit' => 20,
|
|
|
'maxLimit' => 100,
|
|
|
];
|
|
|
+
|
|
|
$this->Paginator->setConfig('allowedParameters', ['fields']);
|
|
|
$defaults = $this->Paginator->getDefaults('Post', $settings);
|
|
|
$result = $this->Paginator->mergeOptions($params, $defaults);
|
|
|
@@ -463,6 +480,8 @@ trait PaginatorTestTrait
|
|
|
'maxLimit' => 100,
|
|
|
'fields' => ['bad.stuff'],
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction', 'fields'],
|
|
|
+ 'sortableFields' => null,
|
|
|
+ 'finder' => 'all',
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
@@ -484,6 +503,8 @@ trait PaginatorTestTrait
|
|
|
'maxLimit' => 100,
|
|
|
'paramType' => 'named',
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
+ 'sortableFields' => null,
|
|
|
+ 'finder' => 'all',
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
@@ -499,6 +520,8 @@ trait PaginatorTestTrait
|
|
|
'maxLimit' => 10,
|
|
|
'paramType' => 'named',
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
+ 'sortableFields' => null,
|
|
|
+ 'finder' => 'all',
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
@@ -526,6 +549,8 @@ trait PaginatorTestTrait
|
|
|
'Users.username' => 'asc',
|
|
|
],
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
+ 'sortableFields' => null,
|
|
|
+ 'finder' => 'all',
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
@@ -547,6 +572,8 @@ trait PaginatorTestTrait
|
|
|
'Users.username' => 'asc',
|
|
|
],
|
|
|
'allowedParameters' => ['limit', 'sort', 'page', 'direction'],
|
|
|
+ 'sortableFields' => null,
|
|
|
+ 'finder' => 'all',
|
|
|
];
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
@@ -1134,9 +1161,7 @@ trait PaginatorTestTrait
|
|
|
$params = ['page' => '-1'];
|
|
|
$settings = [
|
|
|
'PaginatorPosts' => [
|
|
|
- 'contain' => ['PaginatorAuthor'],
|
|
|
'maxLimit' => 10,
|
|
|
- 'group' => 'PaginatorPosts.published',
|
|
|
'order' => ['PaginatorPosts.id' => 'ASC'],
|
|
|
],
|
|
|
];
|
|
|
@@ -1146,8 +1171,6 @@ trait PaginatorTestTrait
|
|
|
$query->expects($this->once())
|
|
|
->method('applyOptions')
|
|
|
->with([
|
|
|
- 'contain' => ['PaginatorAuthor'],
|
|
|
- 'group' => 'PaginatorPosts.published',
|
|
|
'limit' => 10,
|
|
|
'order' => ['PaginatorPosts.id' => 'ASC'],
|
|
|
'page' => 1,
|
|
|
@@ -1185,10 +1208,8 @@ trait PaginatorTestTrait
|
|
|
$params = ['page' => '-1'];
|
|
|
$settings = [
|
|
|
'PaginatorPosts' => [
|
|
|
- 'contain' => ['PaginatorAuthor'],
|
|
|
'maxLimit' => 10,
|
|
|
'limit' => 5,
|
|
|
- 'group' => 'PaginatorPosts.published',
|
|
|
'order' => ['PaginatorPosts.id' => 'ASC'],
|
|
|
],
|
|
|
];
|
|
|
@@ -1199,8 +1220,6 @@ trait PaginatorTestTrait
|
|
|
$query->expects($this->once())
|
|
|
->method('applyOptions')
|
|
|
->with([
|
|
|
- 'contain' => ['PaginatorAuthor'],
|
|
|
- 'group' => 'PaginatorPosts.published',
|
|
|
'limit' => 5,
|
|
|
'order' => ['PaginatorPosts.id' => 'ASC'],
|
|
|
'page' => 1,
|