Laravel 4测试; 'phpunit'无法识别? [英] Laravel 4 testing; 'phpunit' is not recognized?

查看:65
本文介绍了Laravel 4测试; 'phpunit'无法识别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://four.laravel.com/docs/testing 说:在安装了新的Laravel应用程序之后,在命令行上运行phpunit来运行测试."

http://four.laravel.com/docs/testing Says "After installing a new Laravel application, simply run phpunit on the command line to run your tests."

phpunit无法识别,我也尝试了php artisian testphp artisan phpunit

phpunit isn't recognized, I also tried php artisian test and php artisan phpunit

phpunit是否在某些奇怪的文件夹中,或者它实际上不包含在Laravel中吗?我不想安装它,如果要安装两个.

Is phpunit in some weird folder, or is it actually not included with Laravel? I don't want to install it and have two if it is.

推荐答案

使用作曲家安装

使用PHPUnit进行启动和运行的一种简单方法(无需安装Pear并使您要在其上使用的每个系统杂乱无章)是将其包含在composer.json文件中,例如

Install with composer

An easy way to get up and running with PHPUnit (without needing to install Pear and clutter up every system you want to use this on) is to include it in your composer.json file, like

"phpunit/phpunit": "4.0.*",

然后在执行composer update之后,您将可以从命令行运行PHPUnit,如下所示:

Then after doing a composer update you'll be able to run PHPUnit from command line like this:

vendor/bin/phpunit 

由于phpunit将被安装到vendor/bin文件夹中.

Since phpunit will be installed into the vendor/bin folder.

这只会将PHPUnit安装到该项目,而不是整个系统.因此,当您希望它消失时,您只需从composer.json文件中删除该行,运行composer update和poof,而不是跟踪即可.

This will install PHPUnit to this project only, not your whole system. So when you want it gone, you simply remove the line from your composer.json file, run composer update, and poof, not a trace.

如果只想在开发过程中使用它,则在"require-dev"部分内添加composer行.这样,只有当您选择通过以下方式安装开发依赖项时,才会安装它:

If you only want to use this during development, add the composer line inside the "require-dev" section. That way it will only be installed when you opt to install dev dependancies via:

php composer.phar install --dev

php composer.phar update

这篇关于Laravel 4测试; 'phpunit'无法识别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆