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

时间:2022-03-07 01:51:55

I'm trying to run phpunit within a Yii2 basic installation but whenever I run php vendor/bin/phpunit from the command line I get this output:

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

Note: I am on Windows 7.

注意:我在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" "$@"

Can anyone advise what the issue is here? I haven't used phpunit before so unsure what is happening.

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

1 个解决方案

#1


9  

Well, it was an obvious solution:

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

File vendor/bin/phpunit is not a PHP script, but a shell script.

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

Remove php from the start and simply run vendor/bin/phpunit.

从一开始就删除php,只需运行vendor / bin / phpunit。

Source.

资源。

#1


9  

Well, it was an obvious solution:

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

File vendor/bin/phpunit is not a PHP script, but a shell script.

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

Remove php from the start and simply run vendor/bin/phpunit.

从一开始就删除php,只需运行vendor / bin / phpunit。

Source.

资源。