Configuration

To configure PHPUnit follow these steps:

1. From the menu bar select Window -> Preferences

Open Preferences

2. From the tree view of Preferences page select PHP Tools -> PHPUnit. On this page you can configure PHPUnit.

PHPUnit Preferences

3. First select a PHP Executable for running PHPUnit

PHP Executable Option

4. You can choose to use your own PEAR library or the internal. Note that the internal library is always within the include path so missing packages are used from there.

PEAR Library Option

5. If you wish to print PHP output to console for debugging activate the checkbox.

Print PHP output to console?

6. Select your Test Case SuperClass which will be used instead of the generated from PHPUnit.

Insert the Test Case SuperClass

7. Define where your Test Case files should be stored. You can use the %p as project placeholder and %d[{start,end}] as directory placeholder.

Examples for file /library/myframework/subfolder1/subfolder2/filename.php:
%d = /library/myframework/subfolder1/subfolder2
%d{3} = subfolder1
%d{2,3} = myframework/subfolder1
%d{,3} = library/myframework/subfolder1
%d{2,} = myframework/subfolder1/subfolder2

Insert the Test Folder Pattern

8. The next field defines where the PHP Class should be stored. If you used the whole path for your Test Cases this field is optional. You can use the same placeholder as for the Test Folder Pattern (see Point 7).

Insert Source Folder Pattern

9. The File Name Pattern defines the format of your Test Case filenames. Use placeholder %f for short filename or %ff for long filename without extension and %e for file extension.

Example for the file part1.part2.part3.php:
%f = part1
%ff = part1.part2.part3
%e = php

Insert File Name Pattern

10. If you want your own bootstrap file you can select it here.

Select Bootstrap File

11. If you want to generate code coverage informations you can activate this checkbox. Not covered lines are marked with a information problem marker. Note that this feature needs the Xdebug PHP extension. See also HowTo change the code coverage annotations.

Generate code coverage?

12. PTI checks the namespace while searching for a Test Case or PHP Class file. For example you have the \Namespace\MyClass class, PTI will search for \Namespace\MyClassTest as Test Case. If your Tests have no or different namespaces you should active this option and PTI will ignore namespaces.

Do not check for equals namespaces?

window_preferences.gif - Open Preferences (29.9 KB) Sven Kiera, 01/18/2011 11:35 am

phpunit_preferences.png - PHPUnit Preferences (83.4 KB) Sven Kiera, 01/18/2011 11:35 am

phpunit_preferences_source_folder_pattern.png - Insert Source Folder Pattern (1.48 KB) Sven Kiera, 01/18/2011 11:45 am

phpunit_preferences_file_name_pattern.png - Insert File Name Pattern (2.07 KB) Sven Kiera, 01/18/2011 11:45 am

phpunit_preferences_bootstrap_file.png - Select Bootstrap File (1.89 KB) Sven Kiera, 01/18/2011 11:45 am

phpunit_preferences_code_coverage.png - Generate code coverage? (1.87 KB) Sven Kiera, 01/18/2011 11:45 am

phpunit_preferences_php_executable.png - PHP Executable Option (2.52 KB) Sven Kiera, 01/18/2011 11:45 am

phpunit_preferences_pear_library.png - PEAR Library Option (2.52 KB) Sven Kiera, 01/18/2011 11:45 am

phpunit_preferences_debug.png - Print PHP output to console? (1.92 KB) Sven Kiera, 01/18/2011 11:45 am

phpunit_preferences_superclass.png - Insert the Test Case SuperClass (2.33 KB) Sven Kiera, 01/18/2011 11:45 am

phpunit_preferences_check_namespaces.png - Do not check for equals namespaces? (2.06 KB) Sven Kiera, 01/18/2011 11:45 am

phpunit_preferences_test_folder_pattern.png - Insert the Test Folder Pattern (2.17 KB) Sven Kiera, 01/18/2011 11:45 am