简体   繁体   中英

How to install PHPunit in a Laravel project

I'm trying to set up PHPunit in a Laravel project (which is being running in a Linux VM using Vagrant and VirtualBox). I've added PHPunit to composer.json and run composer install and composer update , and yet nothing is working. Running phpunit from the command line does nothing. (Nor does php phpunit or php phpunit.phar .)

How do I get PHPunit to run my tests?

您现在必须使用以下命令运行它:

vendor/bin/phpunit

Install phpunit globally and then can you can use it with just phpunit command in your local project instead of vendor/bin/phpunit (your composer/vendor/bin has to be in system path)

composer global require phpunit/phpunit

or you can add following alias in your VM and then you can run it within your project directory with just phpunit command

alias phpunit='vendor/bin/phpunit'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM