PHPUnit not working with Laravel 5

 

I just installed a fresh Laravel 5 project, my first one on this version. PHPUnit is supposed to be out of the box with the framework and every tutorials I saw just say to type phpunit within the project folder to launch the Unit Tests.

I checked and PHPUnit is in the composer.json, I also did a composer install and composer update just in case it wouldn't be here

website(master)$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing phpunit/phpunit (4.6.1)
  - Installing phpunit/phpunit (4.6.2)
    Downloading: 100%

But it just doesn't work phpunit isn't recognized at all

 website(master)$ phpunit
-bash: phpunit: command not found

Seems like nobody got this problem before as I Googled it. I hope I'm not doing any stupid mistake. Any idea or suggestion ? Thanks guys ;)

share improve this question
 
5 
./vendor/bin/phpunit –  zerkms  Apr 8 '15 at 1:29
   
alright thank you, that was pretty stupid at the end but i'm sure some people would do the same ^^ –  Laurent  Apr 8 '15 at 1:37
1 
@Laurent it's not uncommon to have PHPUnit installed globally on your system so you can run phpunitfrom anywhere –  Phil  Apr 8 '15 at 1:43
   
Yeah I installed it globally and it works well now –  Laurent  Apr 8 '15 at 1:44

2 Answers

up vote 9 down vote accepted

I didn't install PHPUnit globally and didn't define the path. So for anyone who would have same problem :

composer global require phpunit/phpunit
composer global require phpunit/dbunit

Then you add this to you ~/.bash_profile or ~/.profile

export PATH=~/.composer/vendor/bin:$PATH
share improve this answer
 
   
It works , thanks . –  Chutipong Roobklom  Mar 2 at 16:03
 

Include this line on your composer.json

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

Run composer update. You should be able to run the following command on your Laravel directory.

vendor/bin/phpunit 
share improve this answer
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值