Assumption
- PEAR has been installed
- Running on Window 7
- Download PHPUnit 3.7.25 from https://github.com/sebastianbergmann/phpunit/ ("phpunit.phar" will be downloaded)
- Follow the Zend 2 sample tutorial to prepare the unit testing script http://framework.zend.com/manual/2.0/en/user-guide/unit-testing.html
Steps to configure
Steps to configure
1. Install phpunit on your machine by running the command as described below in "Command Prompt" window with phpunit.phar in the same directory.
pear config-set auto_discover 1 pear install pear.phpunit.de/PHPUnit
phpunit --version PHPUnit 3.7.25 by Sebastian Bergmann.
3. In Aptana Studio 3.0, "External Tools" menu will not be available in the "Run" menu. Steps as described below are required to turn on the "External Tools" option.
- Right click the "Web Perspective" and select "Customize" menu, "Customize Perspective" screen will be displayed.
- Select "Command Groups Availability" tab and check the "External Tools" check box as shown in the screenshots below.
- Click on "Ok" button to dismiss the "Customize Perspective" screen. Click on "Run" menu, "External Tools" will be displayed.
4. Select "Run" -> "External Tools" -> "External Tools Configuration", the configuration screen will be displayed.
5. Fill in the details as described below
Name: PHPUnit
Location: [PEAR_INSTALL_PATH]\phpunit.bat
Note: Normally phpunit.bat is located at the PEAR installation path if PEAR is used to install PHPUnit.
Working Directory: ${project_loc}/module/Application/test
Note: Based on the tutorial provided by Zend2, http://framework.zend.com/manual/2.0/en/user-guide/unit-testing.html, this should be the folder that consists of "phpunit.xml.dist" file.
6. Select unit testing class, for example, "IndexControllerText.php", click on "Run" -> "External Tools" -> "PHPUnit", the unit testing script will be executed and test result will be output to "Console" screen.
No comments:
Post a Comment