Unit Testing In Netbeans Ide

I installed phpunit and selenium correctly. I tested SiteTest.php and encountered the error below.

PHP Fatal error: Call to undefined function json_decode() in /opt/lampp/htdocs/rdmssql_v3.0.0/protected/config/main.php on line 176

Please take note that we have made some modifications in main.php to dynamically add/register modules in main.php

which includes the adding of json_decode in main.php. We don’t have issue when accessing it through web.

Any explanation why this error is happening?

It looks like you have to install manually extension for json. Check what is your phpinfo() saying.

If you use php > 5.2, JSON extension should be installed be default, more info is here: http://www.php.net/m...nstallation.php

Thanks for the replies, I figured out that the reason why json_decode is working in my webapp when viewed through web browser is that I am using LAMPP where json is already enabled, while in unit testing, it uses the php in /usr/bin/php which has different set of php.ini.

Further details is that I am using ubuntu 13.10 version and solved this issue by installing/enabling json using the following command:

sudo apt-get install php5-json

Now, phpunit is working!

Thanks for letting know :)