diff --git a/bin/code-coverage-checker.php b/bin/code-coverage-checker.php index b39e2d5..41e2768 100644 --- a/bin/code-coverage-checker.php +++ b/bin/code-coverage-checker.php @@ -22,9 +22,17 @@ $loader = require $autoloaderFile; - $phpunitBridgeDirectory = dirname(realpath($autoloaderFile)) . '/bin/.phpunit'; - - if (is_dir($phpunitBridgeDirectory)) { + + $phpunitBridgeDirectories = [ + dirname(realpath($autoloaderFile)) . '/bin/.phpunit', + dirname(dirname(realpath($autoloaderFile))) . '/bin/.phpunit', + ]; + + foreach ($phpunitBridgeDirectories as $phpunitBridgeDirectory) { + if (!is_dir($phpunitBridgeDirectory)) { + continue; + } + $files = scandir($phpunitBridgeDirectory); foreach ($files as $file) { @@ -36,6 +44,8 @@ && file_exists($phpunitAutoloader) ) { require $phpunitAutoloader; + + break 2; } } } @@ -93,7 +103,7 @@ $message = sprintf( 'Line Coverage for all included files: %.2F%% (%d/%d).', - $totalCoveredLines / $totalExecutableLines * 100, + $totalExecutableLines ? $totalCoveredLines / $totalExecutableLines * 100 : 100, $totalCoveredLines, $totalExecutableLines );