zhamao-framework/bin/phpunit-swoole
2022-03-28 17:27:36 +08:00

48 lines
922 B
PHP
Executable File

#!/usr/bin/env php
<?php
/** For Swoole coroutine tests */
$root = dirname(__DIR__);
co::set([
'log_level' => SWOOLE_LOG_INFO,
'trace_flags' => 0
]);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
if (PHP_VERSION_ID <= 70100) {
fwrite(
STDERR,
sprintf(
'This version of PHPUnit is supported on PHP 7.1 and above.' . PHP_EOL .
'You are using PHP %s (%s).' . PHP_EOL,
PHP_VERSION,
PHP_BINARY
)
);
die(1);
}
if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}
require $root . '/vendor/autoload.php';
sleep(1);
go(static function () {
PHPUnit\TextUI\Command::main(false);
Swoole\Process::wait();
});
Swoole\Event::wait();