diff --git a/app/Console/Controller/PhpController.php b/app/Console/Controller/PhpController.php index eaff103..31d29b7 100644 --- a/app/Console/Controller/PhpController.php +++ b/app/Console/Controller/PhpController.php @@ -192,7 +192,7 @@ public function sql2arrCommand(FlagsParser $fs, Output $output): void * * @example * Use special php and phpunit: - * {binWithCmd} --php-bin php7 --phpunit /Users/inhere/.composer/vendor/phpunit/phpunit/phpunit -f KEYWORDS ./test + * {binWithCmd} --php-bin php7 --phpunit /Users/inhere/.composer/vendor/phpunit/phpunit/phpunit -f KEYWORDS ./test * * @param FlagsParser $fs * @param Output $output @@ -204,6 +204,8 @@ public function runUnitCommand(FlagsParser $fs, Output $output): void $dir = dirname($dir); } + $output->info('unit tests code dir or file: ' . $dir); + $runDir = KiteUtil::findPhpUnitConfigFile($dir); if (!$runDir) { throw new InvalidArgumentException("not found the phpunit.xml(.dist) in $dir or any parent dir"); diff --git a/app/Helper/KiteUtil.php b/app/Helper/KiteUtil.php index a6f81fd..8e4747a 100644 --- a/app/Helper/KiteUtil.php +++ b/app/Helper/KiteUtil.php @@ -137,7 +137,7 @@ public static function findPhpUnitConfigFile(string $dir): string $dir = FS::realpath($dir); while (true) { - if (!$dir) { + if (!trim($dir, '/')) { break; }