2014-11-05 86 views

回答

7

您可以將當前目錄添加到您的路徑中。

對於Linux/Mac,將以下內容添加到您的.bash_profile中,Windows將類似,請更改下面的行並將其添加到您的PATH

# include the current `vendor/bin` folder (Notice the `.` - This means current directory) 
PATH="./vendor/bin:$PATH" 

記得重新啓動您的終端或資源的bash_profile

現在你應該可以運行:phpunit它會自動在./vendor/bin之內尋找它,如果它存在,它將使用它來執行。

+0

非常感謝您的回答。我正在使用Windows 7與WampServer。我在哪裏可以找到'.bash_profile'文件? – user1995781 2014-11-06 14:12:53

+2

結帳:http://www.computerhope.com/issues/ch000549.htm或http://superuser.com/questions/602872/how-do-i-modify-my-git-bash-profile-in-windows - 它只是我們想要添加的「環境變量」。 – Anil 2014-11-06 14:28:05

0

如果在宅基地(或一些其它的Linux/Ubuntu系統)上運行:

alias p='vendor/bin/phpunit' 

然後,你可以只輸入p,它會如果您正在使用宅基地運行測試

- 你可以將此別名添加到您的aliases文件中,以便它始終存在。

2

另一種簡單的解決方案,從composer documentation,是您bin-dir設置設爲./。這會將二進制文件安裝到根目錄中。

"config": { 
    "bin-dir": "./" 
} 

然後你可以運行./phpunit。我通常將bin-dir設置爲bin,然後鍵入bin/phpunit。對我來說足夠短。

如果您已經安裝了phpunit,您需要先刪除vendor/phpunit目錄並重新運行composer install,然後作曲者才能移動二進制文件。

相關問題