Skip to content

Commit

Permalink
Use Cake\Database\Query::expr() instead of `Cake\Database\Query::ne…
Browse files Browse the repository at this point in the history
…wExpr()` in testing (#44)
  • Loading branch information
chitoku-k authored Mar 16, 2023
1 parent 124d439 commit 9e4c3a2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
60 changes: 30 additions & 30 deletions tests/TestCase/Model/Behavior/LampagerBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,8 @@ function (Table $posts) {
->forward()
->seekable()
->limit(3)
->orderAsc($posts->query()->newExpr('modified'))
->orderAsc($posts->query()->newExpr('id'));
->orderAsc($posts->query()->expr('modified'))
->orderAsc($posts->query()->expr('id'));
},
new PaginationResult(
[
Expand Down Expand Up @@ -698,8 +698,8 @@ function (Table $posts) {
->forward()
->seekable()
->limit(3)
->orderAsc($posts->query()->newExpr('modified'))
->orderAsc($posts->query()->newExpr('id'))
->orderAsc($posts->query()->expr('modified'))
->orderAsc($posts->query()->expr('id'))
->cursor([
'id' => 3,
'modified' => new FrozenTime('2017-01-01 10:00:00'),
Expand Down Expand Up @@ -743,8 +743,8 @@ function (Table $posts) {
->seekable()
->exclusive()
->limit(3)
->orderAsc($posts->query()->newExpr('modified'))
->orderAsc($posts->query()->newExpr('id'))
->orderAsc($posts->query()->expr('modified'))
->orderAsc($posts->query()->expr('id'))
->cursor([
'id' => 3,
'modified' => new FrozenTime('2017-01-01 10:00:00'),
Expand Down Expand Up @@ -784,8 +784,8 @@ function (Table $posts) {
->backward()
->seekable()
->limit(3)
->orderAsc($posts->query()->newExpr('modified'))
->orderAsc($posts->query()->newExpr('id'));
->orderAsc($posts->query()->expr('modified'))
->orderAsc($posts->query()->expr('id'));
},
new PaginationResult(
[
Expand Down Expand Up @@ -822,8 +822,8 @@ function (Table $posts) {
->seekable()
->exclusive()
->limit(3)
->orderAsc($posts->query()->newExpr('modified'))
->orderAsc($posts->query()->newExpr('id'));
->orderAsc($posts->query()->expr('modified'))
->orderAsc($posts->query()->expr('id'));
},
new PaginationResult(
[
Expand Down Expand Up @@ -859,8 +859,8 @@ function (Table $posts) {
->backward()
->seekable()
->limit(3)
->orderAsc($posts->query()->newExpr('modified'))
->orderAsc($posts->query()->newExpr('id'))
->orderAsc($posts->query()->expr('modified'))
->orderAsc($posts->query()->expr('id'))
->cursor([
'id' => 3,
'modified' => new FrozenTime('2017-01-01 10:00:00'),
Expand Down Expand Up @@ -897,8 +897,8 @@ function (Table $posts) {
->seekable()
->exclusive()
->limit(3)
->orderAsc($posts->query()->newExpr('modified'))
->orderAsc($posts->query()->newExpr('id'))
->orderAsc($posts->query()->expr('modified'))
->orderAsc($posts->query()->expr('id'))
->cursor([
'id' => 3,
'modified' => new FrozenTime('2017-01-01 10:00:00'),
Expand Down Expand Up @@ -930,8 +930,8 @@ function (Table $posts) {
->forward()
->seekable()
->limit(3)
->orderDesc($posts->query()->newExpr('modified'))
->orderDesc($posts->query()->newExpr('id'));
->orderDesc($posts->query()->expr('modified'))
->orderDesc($posts->query()->expr('id'));
},
new PaginationResult(
[
Expand Down Expand Up @@ -968,8 +968,8 @@ function (Table $posts) {
->seekable()
->exclusive()
->limit(3)
->orderDesc($posts->query()->newExpr('modified'))
->orderDesc($posts->query()->newExpr('id'));
->orderDesc($posts->query()->expr('modified'))
->orderDesc($posts->query()->expr('id'));
},
new PaginationResult(
[
Expand Down Expand Up @@ -1005,8 +1005,8 @@ function (Table $posts) {
->forward()
->seekable()
->limit(3)
->orderDesc($posts->query()->newExpr('modified'))
->orderDesc($posts->query()->newExpr('id'))
->orderDesc($posts->query()->expr('modified'))
->orderDesc($posts->query()->expr('id'))
->cursor([
'id' => 3,
'modified' => new FrozenTime('2017-01-01 10:00:00'),
Expand Down Expand Up @@ -1043,8 +1043,8 @@ function (Table $posts) {
->seekable()
->exclusive()
->limit(3)
->orderDesc($posts->query()->newExpr('modified'))
->orderDesc($posts->query()->newExpr('id'))
->orderDesc($posts->query()->expr('modified'))
->orderDesc($posts->query()->expr('id'))
->cursor([
'id' => 3,
'modified' => new FrozenTime('2017-01-01 10:00:00'),
Expand Down Expand Up @@ -1076,8 +1076,8 @@ function (Table $posts) {
->backward()
->seekable()
->limit(3)
->orderDesc($posts->query()->newExpr('modified'))
->orderDesc($posts->query()->newExpr('id'));
->orderDesc($posts->query()->expr('modified'))
->orderDesc($posts->query()->expr('id'));
},
new PaginationResult(
[
Expand Down Expand Up @@ -1114,8 +1114,8 @@ function (Table $posts) {
->seekable()
->exclusive()
->limit(3)
->orderDesc($posts->query()->newExpr('modified'))
->orderDesc($posts->query()->newExpr('id'));
->orderDesc($posts->query()->expr('modified'))
->orderDesc($posts->query()->expr('id'));
},
new PaginationResult(
[
Expand Down Expand Up @@ -1151,8 +1151,8 @@ function (Table $posts) {
->backward()
->seekable()
->limit(3)
->orderDesc($posts->query()->newExpr('modified'))
->orderDesc($posts->query()->newExpr('id'))
->orderDesc($posts->query()->expr('modified'))
->orderDesc($posts->query()->expr('id'))
->cursor([
'id' => 3,
'modified' => new FrozenTime('2017-01-01 10:00:00'),
Expand Down Expand Up @@ -1196,8 +1196,8 @@ function (Table $posts) {
->seekable()
->exclusive()
->limit(3)
->orderDesc($posts->query()->newExpr('modified'))
->orderDesc($posts->query()->newExpr('id'))
->orderDesc($posts->query()->expr('modified'))
->orderDesc($posts->query()->expr('id'))
->cursor([
'id' => 3,
'modified' => new FrozenTime('2017-01-01 10:00:00'),
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/ORM/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public function testOrderQueryExpression(): void
);

$actual = $posts->lampager()
->order([$posts->query()->newExpr(['modified'])])
->order([$posts->query()->newExpr(['id'])])
->order([$posts->query()->expr('modified')])
->order([$posts->query()->expr('id')])
->limit(1)
->all();

Expand Down Expand Up @@ -155,7 +155,7 @@ public function testLimitQueryExpression(): void
$actual = $posts->lampager()
->orderAsc('modified')
->orderAsc('id')
->limit($posts->query()->newExpr(['1']))
->limit($posts->query()->expr('1'))
->all();

$this->assertJsonEquals($expected, $actual);
Expand All @@ -172,7 +172,7 @@ public function testLimitIllegalQueryExpression(): void
$posts->lampager()
->orderAsc('modified')
->orderAsc('id')
->limit($posts->query()->newExpr(['1 + 1']))
->limit($posts->query()->expr('1 + 1'))
->all();
}

Expand Down

0 comments on commit 9e4c3a2

Please sign in to comment.