11#!/usr/bin/env php
2- <?php
3-
2+ <?php
3+ declare (strict_types=1 );
4+ /*
5+ * This file is part of PHPUnit.
6+ *
7+ * (c) Sebastian Bergmann <[email protected] > 8+ *
9+ * For the full copyright and license information, please view the LICENSE
10+ * file that was distributed with this source code.
11+ */
12+ if (version_compare ('7.3.0 ' , PHP_VERSION , '> ' )) {
13+ fwrite (STDERR , sprintf ('This version of PHPUnit requires PHP >= 7.3. ' . PHP_EOL . 'You are using PHP %s (%s). ' . PHP_EOL , PHP_VERSION , PHP_BINARY ));
14+ die (1 );
15+ }
16+ if (!ini_get ('date.timezone ' )) {
17+ ini_set ('date.timezone ' , 'UTC ' );
18+ }
19+ foreach (array (__DIR__ . '/../../autoload.php ' , __DIR__ . '/../vendor/autoload.php ' , __DIR__ . '/vendor/autoload.php ' ) as $ file ) {
20+ if (file_exists ($ file )) {
21+ define ('PHPUNIT_COMPOSER_INSTALL ' , $ file );
22+ break ;
23+ }
24+ }
25+ unset($ file );
26+ if (!defined ('PHPUNIT_COMPOSER_INSTALL ' )) {
27+ fwrite (STDERR , 'You need to set up the project dependencies using Composer: ' . PHP_EOL . PHP_EOL . ' composer install ' . PHP_EOL . PHP_EOL . 'You can learn all about Composer on https://getcomposer.org/. ' . PHP_EOL );
28+ die (1 );
29+ }
30+ $ options = getopt ('' , array ('prepend: ' ));
31+ if (isset ($ options ['prepend ' ])) {
32+ require $ options ['prepend ' ];
33+ }
34+ unset($ options );
35+ require PHPUNIT_COMPOSER_INSTALL ;
436$ code = 0 ;
5- Swoole \Coroutine::set (['exit_condition ' => function () {
37+ Swoole \Coroutine::set (['hook_flags ' => SWOOLE_HOOK_ALL , ' exit_condition ' => function () {
638 return Swoole \Coroutine::stats ()['coroutine_num ' ] === 0 ;
739}]);
8- Swoole \Coroutine::create (function () use (&$ code ) {
9- if (version_compare ('7.1.0 ' , PHP_VERSION , '> ' )) {
10- fwrite (
11- STDERR ,
12- sprintf (
13- 'This version of PHPUnit is supported on PHP 7.1 and PHP 7.2. ' . PHP_EOL .
14- 'You are using PHP %s (%s). ' . PHP_EOL ,
15- PHP_VERSION ,
16- PHP_BINARY
17- )
18- );
19-
20- die (1 );
21- }
22-
23- if (! ini_get ('date.timezone ' )) {
24- ini_set ('date.timezone ' , 'UTC ' );
25- }
26-
27- $ dirs = [
28- getcwd () . '/vendor/autoload.php ' ,
29- __DIR__ . '/../../autoload.php ' ,
30- __DIR__ . '/../vendor/autoload.php ' ,
31- __DIR__ . '/vendor/autoload.php ' ,
32- ];
33-
34- foreach ($ dirs as $ file ) {
35- if (file_exists ($ file )) {
36- define ('PHPUNIT_COMPOSER_INSTALL ' , $ file );
37-
38- break ;
39- }
40- }
41-
42- unset($ file );
43-
44- if (! defined ('PHPUNIT_COMPOSER_INSTALL ' )) {
45- fwrite (
46- STDERR ,
47- 'You need to set up the project dependencies using Composer: ' . PHP_EOL . PHP_EOL .
48- ' composer install ' . PHP_EOL . PHP_EOL .
49- 'You can learn all about Composer on https://getcomposer.org/. ' . PHP_EOL
50- );
51-
52- die (1 );
53- }
54-
55- $ options = getopt ('' , ['prepend: ' ]);
56-
57- if (isset ($ options ['prepend ' ])) {
58- require $ options ['prepend ' ];
59- }
60-
61- unset($ options );
62-
63- require PHPUNIT_COMPOSER_INSTALL ;
64-
40+ Swoole \Coroutine \run (function () use (&$ code ) {
6541 $ code = PHPUnit \TextUI \Command::main (false );
66-
6742 Swoole \Timer::clearAll ();
6843});
69-
70- swoole_event_wait ();
71-
72- exit ($ code );
44+ die ($ code );
0 commit comments