$ vendor/bin/codecept run unit
Codeception PHP Testing Framework v3.1.2
Powered by PHPUnit 7.5.17 by Sebastian Bergmann and contributors.
Running with seed:
In Run.php line 442:
preg_match(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 7
run [-o|--override OVERRIDE] [-e|--ext EXT] [--report] [--html [HTML]] [--xml [XML]] [--phpunit-xml [PHPUNIT-XML]] [--tap [TAP]] [--json [JSON]] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [-
-bootstrap [BOOTSTRAP]] [--no-redirect] [--coverage [COVERAGE]] [--coverage-html [COVERAGE-HTML]] [--coverage-xml [COVERAGE-XML]] [--coverage-text [COVERAGE-TEXT]] [--coverage-crap4j [COVERAGE-CRAP4J]] [--c
overage-phpunit [COVERAGE-PHPUNIT]] [--no-exit] [-g|--group GROUP] [-s|--skip SKIP] [-x|--skip-group SKIP-GROUP] [--env ENV] [-f|--fail-fast] [--no-rebuild] [--seed SEED] [--] [<suite> [<test>]]
使用 vendor/bin/codecept run unit -vvv
$ vendor/bin/codecept run unit -vvv
Codeception PHP Testing Framework v3.1.2
Powered by PHPUnit 7.5.17 by Sebastian Bergmann and contributors.
Running with seed:
In Run.php line 442:
[yii\base\ErrorException (2)]
preg_match(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 7
Exception trace:
at C:\work\phpstudy\PHPTutorial\WWW\wzl_api\gzh\vendor\codeception\codeception\src\Codeception\Command\Run.php:442
yii\base\ErrorHandler->handleError() at n/a:n/a
preg_match() at C:\work\phpstudy\PHPTutorial\WWW\wzl_api\gzh\vendor\codeception\codeception\src\Codeception\Command\Run.php:442
Codeception\Command\Run->matchSingleTest() at C:\work\phpstudy\PHPTutorial\WWW\wzl_api\gzh\vendor\codeception\codeception\src\Codeception\Command\Run.php:370
Codeception\Command\Run->execute() at C:\work\phpstudy\PHPTutorial\WWW\wzl_api\gzh\vendor\symfony\console\Command\Command.php:255
Symfony\Component\Console\Command\Command->run() at C:\work\phpstudy\PHPTutorial\WWW\wzl_api\gzh\vendor\symfony\console\Application.php:934
Symfony\Component\Console\Application->doRunCommand() at C:\work\phpstudy\PHPTutorial\WWW\wzl_api\gzh\vendor\symfony\console\Application.php:273
Symfony\Component\Console\Application->doRun() at C:\work\phpstudy\PHPTutorial\WWW\wzl_api\gzh\vendor\symfony\console\Application.php:149
Symfony\Component\Console\Application->run() at C:\work\phpstudy\PHPTutorial\WWW\wzl_api\gzh\vendor\codeception\codeception\src\Codeception\Application.php:107
Codeception\Application->run() at C:\work\phpstudy\PHPTutorial\WWW\wzl_api\gzh\vendor\codeception\codeception\codecept:43
找到准确的run.php地址,var_dump()一下发现是:test\unit这个在preg_match时,把‘\’一起转化了
所以在此之前加上 "$testsPath = preg_quote($testsPath);"
$testsPath = $config['paths']['tests'] . DIRECTORY_SEPARATOR . $suiteConfig['path'];
if ($suiteConfig['path'] === '.') {
$testsPath = $config['paths']['tests'];
}
$testsPath = preg_quote($testsPath);
if (preg_match("~^$testsPath/(.*?)$~", $suite, $matches)) {
$matches[2] = $matches[1];
$matches[1] = $s;
return $matches;
}