[英]How to set up phpUnit alias for laravel project?
I installed phpunit using composer to project.我使用 composer 来安装 phpunit 来投影。
composer require --dev phpunit/phpunit ^7
It is installed correctly.它已正确安装。 But how to set up aliases to use
但是如何设置别名来使用
~$ phpunit
to run all tests.运行所有测试。 I found that
~$ vendor/bin/phpunit
works.我发现
~$ vendor/bin/phpunit
有效。 Where and how to set up alias for that in Ubuntu 18.04?在 Ubuntu 18.04 中在哪里以及如何为其设置别名?
You could just set up an alias in your ~/bash_profile
您可以在
~/bash_profile
中设置一个别名
alias phpunit='vendor/bin/phpunit'
Now you can enter现在你可以输入
~$ phpunit
in your project and the local phpunit from vendor/bin/phpunit
will be executed.在您的项目中,来自
vendor/bin/phpunit
将被执行。
An alias you talk about is for global use, the phpunit
inside the vendor folder is for that project only.您谈论的别名供全球使用,供应商文件夹内的
phpunit
仅供该项目使用。
Install PHPunit globally全局安装PHPunit
Install PHPunit
globally if you want to use $ phpunit
everywhere ( more info ).如果您想在所有地方使用
$ phpunit
(更多信息),请全局安装PHPunit
。
$ wget https://phar.phpunit.de/phpunit-6.5.phar
$ chmod +x phpunit-6.5.phar
$ sudo mv phpunit-6.5.phar /usr/local/bin/phpunit
$ phpunit --version
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.