doukuai3822 2015-01-23 16:33
浏览 110
已采纳

在Laravel的Homestead中运行PHPUnit

I'm using Homestead to serve my Laravel application. I'm trying to run PHPUnit. According to the docs:

An example test file is provided in the app/tests directory. After installing a new Laravel application, simply run phpunit on the command line to run your tests.

Well, when I'm "simply running" phpunit in my project root (inside the Homestead environment) I get this:

The program 'phpunit' is currently not installed.

Do I need to install PHPUnit separately then? The documentation does not mention it. What am I doing wrong?

  • 写回答

3条回答 默认 最新

  • douhe1864 2015-01-23 16:55
    关注

    You can install it globally on the system using.

    composer global require phpunit/phpunit
    

    However, if you need different versions for different projects this can cause issues.

    The alternative option is to use the version installed as part of your dependencies by referencing the path to your vendor directory.

    ./vendor/bin/phpunit
    

    You could even add an alias to your aliases file in your ~/Homestead directory. That way you're always using the phpunit version that is installed with your project dependencies.

    alias phpunit=./vendor/bin/phpunit
    

    You'll need to restart the homestead box to make use of the alias.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办