November 23rd, 2010

Zend Studio + Soap Client + PHP Unit

Some tips and tricks on how to get the best out of your Zend Studio IDE; PHPUnit tests out-of-the-box were not that easy to get going, here is how you can.

— Matt Fellows —

Unit testing Soap Client with PHP Unit and Zend Studio

I had a bit of trouble getting this to work out of the box, so I thought I would share this with others. To get this working, do the following:

  • Install PHP 5 with at least the following configuration option ‘–enable-soap’
  • In Zend Studio open ‘Window > Preferences > PHP >Executables’ and choose ‘Add’. Enter the location of the php executable from your PHP 5 install (/usr/bin/php for example), save it and set it as the default. This means that your PHP instance will run inside Zend, not one of the ones bundled in Zend, so make sure you have all of the options that you need.
  • Add the following your php.ini file (if you can’t remeber where that is, do a phpinfo() and get the ‘Configuration File (php.ini) Path’ value

# Zend Debugger: Point to the debugger in your Zend Studio installation directory

zend_extension=/home/mfellows/Zend/ZendStudioForEclipse-6.1.1/plugins/org.zend.php.debug.debugger.linux.x86_5.2.15.v20080907/resources/php5/ZendDebugger.so

  • Ensure that when your run configurations for any PHP scripts or PHPUnit tests use your custom PHP executable. You can check this by right-clicking on the file and choosing ‘Run as > Run Configurations’ and ensuring that the PHPScript tab has your PHP executable as the one set

Hope that helps someone…