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
- 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…