问题 尝试在Yii2中运行phpunit时出现Cygwin问题


我想跑 phpunit 在Yii2基本安装中,但每当我运行 php vendor/bin/phpunit 从命令行我得到这个输出:

注意: 我在Windows 7上。

dir=$(d=${0%[/\\]*}; cd "$d"; cd "../phpunit/phpunit" && pwd)

# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
        # Cygwin paths start with /cygdrive/ which will break windows PHP,
        # so we need to translate the dir path to windows format. However
        # we could be using cygwin PHP which does not require this, so we
        # test if the path to PHP starts with /cygdrive/ rather than /usr/bin
        if [[ $(which php) == /cygdrive/* ]]; then
                dir=$(cygpath -m "$dir");
        fi
fi

dir=$(echo $dir | sed 's/ /\ /g')
"${dir}/phpunit" "$@"

任何人都可以建议这里的问题是什么?我还没用过 phpunit 之前不确定发生了什么。


1011
2017-11-16 10:43


起源

你检查了吗 这个问题? - Bizley
@Bizley谢谢,我来看看。 - Brett


答案:


嗯,这是一个明显的解决方案:

文件 vendor/bin/phpunit 不是PHP脚本,而是shell脚本。

去掉 php 从一开始就简单地运行 vendor/bin/phpunit

资源


10
2017-11-20 11:07