@@ -13,20 +13,20 @@ public function testByValues(): void
1313 {
1414 $ expected = [
1515 '2022_10_13_013321_test1 ' ,
16- 'foo/2022_10_13_013321_test2 ' ,
17- 'bar/2022_10_13_013321_test3 ' ,
18- 'foo/2022_10_13_013321_test4 ' ,
19- 'bar/2022_10_13_013321_test5 ' ,
20- '2022_10_13_013321_test6 ' ,
16+ 'foo/2022_10_13_013322_test2 ' ,
17+ 'bar/2022_10_13_013323_test3 ' ,
18+ 'foo/2022_10_13_013324_test4 ' ,
19+ 'bar/2022_10_13_013325_test5 ' ,
20+ '2022_10_13_013326_test6 ' ,
2121 ];
2222
2323 $ values = [
2424 '2022_10_13_013321_test1 ' ,
25- '2022_10_13_013321_test6 ' ,
26- 'bar/2022_10_13_013321_test3 ' ,
27- 'bar/2022_10_13_013321_test5 ' ,
28- 'foo/2022_10_13_013321_test2 ' ,
29- 'foo/2022_10_13_013321_test4 ' ,
25+ '2022_10_13_013326_test6 ' ,
26+ 'bar/2022_10_13_013323_test3 ' ,
27+ 'bar/2022_10_13_013325_test5 ' ,
28+ 'foo/2022_10_13_013322_test2 ' ,
29+ 'foo/2022_10_13_013324_test4 ' ,
3030 ];
3131
3232 $ this ->assertSame ($ expected , $ this ->sorter ()->byValues ($ values ));
@@ -36,25 +36,54 @@ public function testByKeys(): void
3636 {
3737 $ expected = [
3838 '2022_10_13_013321_test1 ' => 1 ,
39- 'foo/2022_10_13_013321_test2 ' => 2 ,
40- 'bar/2022_10_13_013321_test3 ' => 3 ,
41- 'foo/2022_10_13_013321_test4 ' => 4 ,
42- 'bar/2022_10_13_013321_test5 ' => 5 ,
43- '2022_10_13_013321_test6 ' => 6 ,
39+ 'foo/2022_10_13_013322_test2 ' => 2 ,
40+ 'bar/2022_10_13_013323_test3 ' => 3 ,
41+ 'foo/2022_10_13_013324_test4 ' => 4 ,
42+ 'bar/2022_10_13_013325_test5 ' => 5 ,
43+ '2022_10_13_013326_test6 ' => 6 ,
4444 ];
4545
4646 $ values = [
4747 '2022_10_13_013321_test1 ' => 1 ,
48- '2022_10_13_013321_test6 ' => 6 ,
49- 'bar/2022_10_13_013321_test3 ' => 3 ,
50- 'bar/2022_10_13_013321_test5 ' => 5 ,
51- 'foo/2022_10_13_013321_test2 ' => 2 ,
52- 'foo/2022_10_13_013321_test4 ' => 4 ,
48+ '2022_10_13_013326_test6 ' => 6 ,
49+ 'bar/2022_10_13_013323_test3 ' => 3 ,
50+ 'bar/2022_10_13_013325_test5 ' => 5 ,
51+ 'foo/2022_10_13_013322_test2 ' => 2 ,
52+ 'foo/2022_10_13_013324_test4 ' => 4 ,
5353 ];
5454
5555 $ this ->assertSame ($ expected , $ this ->sorter ()->byKeys ($ values ));
5656 }
5757
58+ public function testByRan (): void
59+ {
60+ $ actions = [
61+ '2022_10_13_013321_test1 ' ,
62+ 'foo/2022_10_13_013322_test2 ' ,
63+ 'bar/2022_10_13_013323_test3 ' ,
64+ 'foo/2022_10_13_013324_test4 ' ,
65+ 'bar/2022_10_13_013325_test5 ' ,
66+ '2022_10_13_013326_test6 ' ,
67+ ];
68+
69+ $ completed = [
70+ '2022_10_13_013321_test1 ' ,
71+ 'foo/2022_10_13_013324_test4 ' ,
72+ 'bar/2022_10_13_013325_test5 ' ,
73+ ];
74+
75+ $ expected = [
76+ '2022_10_13_013321_test1 ' ,
77+ 'foo/2022_10_13_013324_test4 ' ,
78+ 'bar/2022_10_13_013325_test5 ' ,
79+ 'foo/2022_10_13_013322_test2 ' ,
80+ 'bar/2022_10_13_013323_test3 ' ,
81+ '2022_10_13_013326_test6 ' ,
82+ ];
83+
84+ $ this ->assertSame ($ expected , $ this ->sorter ()->byRan ($ actions , $ completed ));
85+ }
86+
5887 protected function sorter (): Sorter
5988 {
6089 return new Sorter ();
0 commit comments