|
15 | 15 |
|
16 | 16 | abstract class TestCase extends PHPUnitTestCase
|
17 | 17 | {
|
| 18 | + const DEFAULT_AWAIT_TIMEOUT = 60; |
| 19 | + |
18 | 20 | /**
|
19 | 21 | * @var string
|
20 | 22 | */
|
@@ -146,40 +148,40 @@ protected function getFilesInDirectory(string $path): array
|
146 | 148 | * @param LoopInterface|null $loop
|
147 | 149 | * @return mixed
|
148 | 150 | */
|
149 |
| - protected function await(PromiseInterface $promise, LoopInterface $loop = null) |
| 151 | + protected function await(PromiseInterface $promise, LoopInterface $loop = null, float $timeout = self::DEFAULT_AWAIT_TIMEOUT) |
150 | 152 | {
|
151 | 153 | if (!($loop instanceof LoopInterface)) {
|
152 | 154 | $loop = Factory::create();
|
153 | 155 | }
|
154 | 156 |
|
155 |
| - return await($promise, $loop); |
| 157 | + return await($promise, $loop, $timeout); |
156 | 158 | }
|
157 | 159 |
|
158 | 160 | /**
|
159 | 161 | * @param array $promises
|
160 | 162 | * @param LoopInterface|null $loop
|
161 | 163 | * @return array
|
162 | 164 | */
|
163 |
| - protected function awaitAll(array $promises, LoopInterface $loop = null) |
| 165 | + protected function awaitAll(array $promises, LoopInterface $loop = null, float $timeout = self::DEFAULT_AWAIT_TIMEOUT) |
164 | 166 | {
|
165 | 167 | if (!($loop instanceof LoopInterface)) {
|
166 | 168 | $loop = Factory::create();
|
167 | 169 | }
|
168 | 170 |
|
169 |
| - return awaitAll($promises, $loop); |
| 171 | + return awaitAll($promises, $loop, $timeout); |
170 | 172 | }
|
171 | 173 |
|
172 | 174 | /**
|
173 | 175 | * @param array $promises
|
174 | 176 | * @param LoopInterface|null $loop
|
175 | 177 | * @return mixed
|
176 | 178 | */
|
177 |
| - protected function awaitAny(array $promises, LoopInterface $loop = null) |
| 179 | + protected function awaitAny(array $promises, LoopInterface $loop = null, float $timeout = self::DEFAULT_AWAIT_TIMEOUT) |
178 | 180 | {
|
179 | 181 | if (!($loop instanceof LoopInterface)) {
|
180 | 182 | $loop = Factory::create();
|
181 | 183 | }
|
182 | 184 |
|
183 |
| - return awaitAny($promises, $loop); |
| 185 | + return awaitAny($promises, $loop, $timeout); |
184 | 186 | }
|
185 | 187 | }
|
0 commit comments