我安装了较旧的 Codeception 2.5(因为 PHP 框架 Yii1 的模块),如下所示:
composer require codeception/codeception:2.5.*
然后执行:
php vendor/bin/codecept run unit --coverage-html
什么也没发生。我只能看到以下代码。我发现文件夹vendor/bin中的所有3个文件(carbon、codecept、phpunit)只包含这个而不是PHP代码:
#!/usr/bin/env sh
dir=$(cd "${0%[/\\]*}" > /dev/null; cd '../codeception/codeception' && pwd)
if [ -d /proc/cygdrive ]; then
case $(which php) in
$(readlink -n /proc/cygdrive)/*)
# We are in Cygwin using Windows php, so the path must be translated
dir=$(cygpath -m "$dir");
;;
esac
fi
"${dir}/codecept" "$@"
这是为什么呢?我在 Vagrant 中使用 Ubuntu 16(CognacBox 图像)。如果我使用 XAMPP 和 Windows 10,它可以正常工作。我使用 Composer v1 和 v2。两者都有同样的问题。
这两个代码库都不再受支持,但是,如果您仍然对这种方法感兴趣,可以使用更新的 Cognacbox 4.0 和最新的 Codeception v5。当使用这些各自系统的当前版本时,它们似乎都可以完全按预期工作。