PHPUnit output with colour

Having fun with PHPUnit? However the testing result there is no colour to display it. Quite boring right?…
phpunit-no-colour

This is the fix, There 2 solutions.

1. EASY

Download ConEmu, https://code.google.com/p/conemu-maximus5/

It is automatic support colour. Just in case it does not work. You need to double check, make sure the Settings->Features.

Both Inject ConEmuHk and ANSI X3.64 / xterm 256 colors are checked.

2. NOT SO EASY…

http://softkube.com/blog/ansi-command-line-colors-under-windows

  1. Download ANSICON from: https://github.com/adoxa/ansicon (SOURCE FILE, you need to compile yourselves) || http://adoxa.altervista.org/ansicon/ (Download the build file, I prefer build file, no need compile it again)
  2. Extract the proper files (Depending on if you have a 32 or 64 bit machine) to c:ansicon (For example). I have a 32 bit machine and hence I extracted the files from inside the x86 folder.
  3. Open an elevated privilege command line prompt and go to c:ansicon, and then type “ansicon -i” without the quotes
  4. Add c:ansicon to your path environment variable
  5. Done. You can now enjoy the colored output of PHPUnit for example.

 

I am using ConEmu. This is the output.

Command Prompt with Colour

Install PHPUnit in Windows

How to install PHPUnit in Windows

prerequisites

1. PHP installed. PHPUnit 4.1 requires PHP 5.3.3; using the latest version of PHP is highly recommended.

2. Set your PHP folder (e.g C:phpbin) to your Environment Variable. Thus, you can run php in your command prompt without full path

 

Step to install PHPUnit

1. Download from the PHPunit website. https://phar.phpunit.de/phpunit.phar, if you PC support wget you can use the following command to download the phpunit.phar to your php bin folder.

wget https://phar.phpunit.de/phpunit.phar

My case it will located in C:phpbinphpunit.phar

2. Create a .bat file, you can create a .txt file rename it to .bat later. Inside the content paste these in


@echo off
php "%~dp0phpunit.phar" %*

Rename your txt file to .bat


C:phpbinphpunit.bat

Access to your Command prompt, try enter the command phpunit, you should able to see the below result:
phpunit

Enjoy your testing!

PS: No color in your testing output in command prompt? Read the next post to enable it!

Samsung Tab 10.1 GSM (1st Gen) P4 GT-P7500 flash to Cyanogenmod ROM

This is my first attempted to flash a Android Rom.

I follow the installation instruction from Cyanogenmod website.

http://wiki.cyanogenmod.org/w/Install_CM_for_p4

Cyanogenmod Odin3-v1.85

Thank God I manage to flash the room to Cyanogenmod. The overall performance is improved. However, I think it is due to the hardware limitation some of the game memory still not really support for it. Well Done Cyanogenmod! I am enjoyed using this ROM.

 

OSX gem guard in guard-phpunit terminal notification

gurd-phpunit + terminal notification:
guard-php + 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.

>guard init
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

Prerequisite

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

5. Done.

Next, You can run the following command to init the Guard in your development folder (~/Sites/testing)
>guard init
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.
  watch(%r{^.+Test.php$})
end

Next Start your guar process to monitor your testing file.

>guard
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'
[1] guard(main)>

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.