File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -571,6 +571,42 @@ public function testListJobsSort(): void
571571 self ::assertSame ($ jobIds , $ resIds );
572572 }
573573
574+ public function testListJobsSortMultipage (): void
575+ {
576+ $ newJobFactory = $ this ->getNewJobFactory ();
577+ $ client = $ this ->getClient ();
578+
579+ $ jobs = array_map (fn () => $ client ->createJob ($ newJobFactory ->createNewJob ([
580+ '#tokenString ' => getenv ('TEST_STORAGE_API_TOKEN ' ),
581+ 'configData ' => [ ],
582+ 'componentId ' => self ::COMPONENT_ID_1 ,
583+ 'mode ' => 'run ' ,
584+ ])), range (1 , 10 ));
585+
586+ $ jobIds = array_map (
587+ fn (JobInterface $ job ) => (int ) $ job ->getId (),
588+ $ jobs ,
589+ );
590+
591+ $ response = $ client ->listJobs (
592+ (new JobListOptions ())
593+ ->setIds ($ jobIds )
594+ ->setSortBy ('id ' )
595+ ->setSortOrder (JobListOptions::SORT_ORDER_DESC )
596+ ->setLimit (3 ),
597+ true
598+ );
599+ self ::assertCount (10 , $ response );
600+
601+ rsort ($ jobIds );
602+ $ resultJobIds = array_map (
603+ fn (JobInterface $ job ) => (int ) $ job ->getId (),
604+ $ response ,
605+ );
606+
607+ self ::assertSame ($ jobIds , $ resultJobIds );
608+ }
609+
574610 public function testListJobsEscaping (): void
575611 {
576612 $ newJobFactory = $ this ->getNewJobFactory ();
You can’t perform that action at this time.
0 commit comments