Files
zhamao-framework/bin/phpunit-swoole

49 lines
933 B
Plaintext
Raw Normal View History

2020-09-29 15:07:43 +08:00
#!/usr/bin/env php
2021-06-16 00:17:30 +08:00
<?php
2022-03-28 17:27:36 +08:00
/** For Swoole coroutine tests */
2020-09-29 15:07:43 +08:00
2022-03-28 17:27:36 +08:00
$root = dirname(__DIR__);
2021-06-16 00:17:30 +08:00
2022-03-28 17:27:36 +08:00
co::set([
2021-06-16 00:17:30 +08:00
'log_level' => SWOOLE_LOG_INFO,
2020-09-29 15:07:43 +08:00
'trace_flags' => 0
]);
2022-03-28 17:27:36 +08:00
/*
* 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.
*/
2020-09-29 15:07:43 +08:00
2022-03-28 17:27:36 +08:00
if (PHP_VERSION_ID <= 70100) {
2020-09-29 15:07:43 +08:00
fwrite(
STDERR,
2022-03-28 17:27:36 +08:00
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
)
2020-09-29 15:07:43 +08:00
);
die(1);
}
2022-03-28 17:27:36 +08:00
if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'Asia/Shanghai');
2022-03-28 17:27:36 +08:00
}
require $root . '/vendor/autoload.php';
sleep(1);
go(static function () {
PHPUnit\TextUI\Command::main(false);
Swoole\Process::wait();
2020-09-29 15:07:43 +08:00
});
2022-03-28 17:27:36 +08:00
Swoole\Event::wait();