Skip to content

Commit 24d3a14

Browse files
authored
Optimized code of co-phpunit. (#1857)
1 parent 02c06e9 commit 24d3a14

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

co-phpunit

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
<?php
33

44
$code = 0;
5-
\Swoole\Coroutine::create(function () use (&$code) {
5+
Swoole\Coroutine::set(['exit_condition' => function(){
6+
return Swoole\Coroutine::stats()['coroutine_num'] === 0;
7+
}]);
8+
Swoole\Coroutine::create(function () use (&$code) {
69
if (version_compare('7.1.0', PHP_VERSION, '>')) {
710
fwrite(
811
STDERR,
@@ -60,6 +63,8 @@ $code = 0;
6063
require PHPUNIT_COMPOSER_INSTALL;
6164

6265
$code = PHPUnit\TextUI\Command::main(false);
66+
67+
Swoole\Timer::clearAll();
6368
});
6469

6570
swoole_event_wait();

0 commit comments

Comments
 (0)