gurd-phpunit + terminal notification:
I am on the way reading Jeffrey Way Testing Book – Laravel Testing Decoded. I followed the way to install guard-phpunit. However it failed.
When I run, I got the below error.
16:03:13 - INFO - Writing new Guardfile to /Users/kenteo/Sites/testing/Guardfile
16:03:13 - ERROR - Could not load 'guard/phpunit' or '~/.guard/templates/phpunit' or find class Guard::Phpunit
I decided follow this solution using-guard-with-the-guard-phpunit-plugin
phpunit needed to be installed.
How to install? To install via terminal:
>curl https://phar.phpunit.de/phpunit.phar -o phpunit.phar
>chmod +x phpunit.phar
>mv phpunit.phar /usr/local/bin/phpunit
1. Remove all ruby gems and ruby completely. Below is the one line magic code.
>for i in`gem list --no-versions`;do sudo gem uninstall -aIx $i; done
2. Install guard-phpunit
>sudo gem install guard-phpunit
3. Install rb-fsevent
>sudo gem install rb-fsevent
4. Install Terminal Notification Guard
>sudo gem install terminal-notification-guard
Next, You can run the following command to init the Guard in your development folder (~/Sites/testing)
You can use the following Guardfile to,
guard :phpunit, :all_on_start => false, :tests_path => 'app/tests/', :cli => '--colors -c phpunit.xml' do
# Run any test in app/tests upon save.
Next Start your guar process to monitor your testing file.
17:22:27 - INFO - Guard is using TerminalNotifier to send notifications.
17:22:27 - INFO - Guard is using TerminalTitle to send notifications.
17:22:27 - INFO - Guard is now watching at '/Users/kenteo/Sites/testing'
This is not the end… Last step you need to fix is phpunit library. If you did not fix it, you will have this error
Call to undefined method PHPUnit_Framework_TestResult::allCompletlyImplemented() in /Library/Ruby/Gems/2.0.0/gems/guard-phpunit-0.1.4/lib/guard/phpunit/formatters/PHPUnit-Progress/PHPUnit/Extensions/Progress/ResultPrinter.php on line 250
Edit for Line 250 & 256
Replace from allCompletlyImplemented to allCompletelyImplemented. People already opened about this issue – allCompletyImplemented spelling issue however the author seem like did not active in development quite a while. I hope the developer can fix it 🙂
Make sure you follow from the start to the end, you should be enjoy your testing process~ God Bless.