Guard:你的机器上没有安装phpunit

时间:2013-12-28 15:35:54

标签: tdd laravel-4 phpunit guard

我使用Guard进行持续测试。

我的Guardfile是

guard :phpunit2, :all_on_start => false, :tests_path => 'app/tests/', :cli => '--colors -c phpunit.xml' do
    # Run any test in app/tests upon save.
    watch(%r{^.+Test\.php$})

    # When a view file is updated, run tests.
    # Tip: you probably only want to run your integration tests.
    watch(%r{app/views/.+\.php}) { Dir.glob('app/tests/**/*.php') }

    # When a file is edited, try to run its associated test.
    # Save app/models/User.php, and it will run app/tests/models/UserTest.php
    watch(%r{^app/(.+)/(.+)\.php$}) { |m| "app/tests/#{m[1]}/#{m[2]}Test.php"}
end

我安装了phpunit,因为作曲家"phpunit/phpunit": "3.7.*"

但是当我使用后卫时:

ERROR - phpunit is not installed on your machine.

我使用phpunit的CLI是vendor/bin/phpunit

所以,我尝试在Guard config中添加Guardfile :command => "vendor/bin/phpunit"

完整的配置:

guard :phpunit2, :all_on_start => false, :tests_path => 'app/tests/', :command => "vendor/bin/phpunit", :cli => '--colors -c phpunit.xml' do

但是,我总是有错误

ERROR - phpunit is not installed on your machine.

怎么办? 感谢

1 个答案:

答案 0 :(得分:0)

你有没有:

gem install guard-phpunit

设置?

看看这个:https://github.com/Maher4Ever/guard-phpunit