File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ public function toArray(): array
78
78
'from ' => $ this ->from ,
79
79
'limit ' => $ this ->limit ,
80
80
'canceledBy ' => $ this ->formatArray ($ this ->canceledBy ),
81
- 'reverse ' => $ this ->reverse ,
81
+ 'reverse ' => $ this ->reverse !== null ? json_encode ( $ this -> reverse ) : null ,
82
82
]
83
83
), static function ($ item ) { return null !== $ item ; }
84
84
);
Original file line number Diff line number Diff line change @@ -114,6 +114,6 @@ public function testSetReverse(): void
114
114
{
115
115
$ data = (new TasksQuery ())->setReverse (true );
116
116
117
- self ::assertSame (['reverse ' => true ], $ data ->toArray ());
117
+ self ::assertSame (['reverse ' => json_encode ( true ) ], $ data ->toArray ());
118
118
}
119
119
}
Original file line number Diff line number Diff line change @@ -140,6 +140,19 @@ public function testCancelTasksWithFilter(): void
140
140
self ::assertSame ('succeeded ' , $ response ['status ' ]);
141
141
}
142
142
143
+ public function testGetAllTasksInReverseOrder (): void
144
+ {
145
+ $ date = new \DateTime ();
146
+
147
+ $ this ->seedIndex ();
148
+ $ this ->seedIndex ();
149
+
150
+ $ tasks = $ this ->client ->getTasks ((new TasksQuery ())->setAfterEnqueuedAt ($ date )->setLimit (2 ));
151
+ $ reversedTasks = $ this ->client ->getTasks ((new TasksQuery ())->setAfterEnqueuedAt ($ date )->setReverse (true )->setLimit (2 ));
152
+
153
+ self ::assertSame ($ reversedTasks ->getResults (), array_reverse ($ tasks ->getResults ()));
154
+ }
155
+
143
156
public function testExceptionIfNoTaskIdWhenGetting (): void
144
157
{
145
158
$ this ->expectException (ApiException::class);
You can’t perform that action at this time.
0 commit comments