Posts Tagged ‘Setup PHPUnit on Windows’


Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 35

Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 35

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 43

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 43

Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 35

Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 35

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 43

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 43

PHPUnit on Windows with WAMP and Netbeans


Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 35

Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 35

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 107

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 107

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 109

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 109

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 111

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 111

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 112

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/ushainfo/public_html/blog/wp-includes/functions.php on line 112
January 29th, 2011

In any software development project, the key to success is the creation of unit test cases and thorough usage of them during development and post development.

On the same line of Java, which provides JUnit as the Unit Testing Framework, PHPUnit can be used. I have gone through many resources on Internet and collated the information in this blog.

Steps to follow

- On successful installation of WAMP, open up the command prompt and go to your php directory in WAMP

- D:\>cd wamp\bin\php\php5.2.5

Pear Set Up

- Execute go-pear.bat file to install PEAR

- Accept the defaults for the questions asked by PEAR

- On installation of PEAR,  run PEAR_ENV.reg. It would create the environment variables to make pear globally available in command line

- D:\wamp\bin\php\php5.2.5>PEAR_ENV.reg

Register PHPUnit with PEAR

- Once you have PEAR setup, then you must register the PHPUnit channel with PEAR

- D:\wamp\bin\php\php5.2.5>pear upgrade pear

- D:\wamp\bin\php\php5.2.5>pear install alldeps force phpunit/phpunit

- You should now find the PHPUnit source files under the PHP directory with phpunit.bat in php main folder

- Restart wamp

XDebug Set Up

- Netbeans version should be 6.8 ( It will not work with version 6.5 )

- Install xdebug using the guidelines from http://xdebug.org/download.php and http://xdebug.org/install.php

- In php.ini ( Apache one ) copy the following lines

a.  zend_extension_ts = “D:/wamp/bin/php/php5.2.9-1/ext/php_xdebug-2.1.0-5.2-vc6.dll”
b.  xdebug.remote_enable=on
c.  xdebug.remote_handler=dbgp
d.  xdebug.remote_host=localhost
e.  xdebug.remote_port=9000

- Restart wamp

- Go to Tools->Options->PHP->general tab

- In general tab there is debugging option: Debugging port:=9000 session ID= netbean xdebug

- Remove net beans and write session ID = xdebug

- Restart IDE.

- Right click on file in the project and go to Tool->create PHPUnit tests . It will ask select the directory with project test file. Create a folder let’s say called “tests” in the project

- Test files would be created inside the folder

- For e.g. if we are writing test case for search.php, searchtest.php in the test folder would be created.

- Right click on the project folder and click on Test which would run all the test cases in the project against all the classes

- Also you can run the code completion by right clicking on the project folder and select code completion which would show you the results as how many functions in the project are there with test cases written for them.

You are all set to test your PHP classes with PHPUnit with debugging enabled.