Skip to content

Commit ed3846a

Browse files
committed
Fix some() test to account for non-deterministic finish order.
1 parent 9033a40 commit ed3846a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

test-kernel/api/functional.some.spec.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ function () {
1919
yield;
2020
},
2121
function () {
22+
yield 0.01;
2223
echo 'b';
23-
yield;
2424
},
2525
function () {
26+
yield 0.02;
2627
echo 'c';
27-
yield;
2828
}
2929
);
3030
expect(ob_get_clean())->to->equal('abc');
@@ -89,21 +89,22 @@ function () {
8989
expect(yield Recoil::some(
9090
2,
9191
function () {
92-
yield;
92+
yield 1; // ensure 'a' takes much longer than the others
9393

9494
return 'a';
9595
},
9696
function () {
97+
yield; // ensure 'b' takes longer than 'c'
98+
9799
return 'b';
98-
yield;
99100
},
100101
function () {
101102
return 'c';
102103
yield;
103104
}
104105
))->to->equal([
105-
1 => 'b',
106106
2 => 'c',
107+
1 => 'b',
107108
]);
108109
});
109110

0 commit comments

Comments
 (0)