AÂ PHPUnit is a testing framework to write andÂ run tests on PHP code. AÂ test file can be created for each class, function and file. PHPUnits allow PHP developers to incrementally buildÂ test suites to constantly review progress and detect unintended side effects.
ToÂ create andÂ run aÂ PHPUnit Test Case:
- In PHP Explorer view, right-click the file you want toÂ test and selectÂ New | PHP UnitÂ TestCase.
- Fill in the required information in the NewÂ PHPUnit Test Case dialog.
- ClickÂ Finish toÂ create yourÂ Test Case file.
- Edit theÂ test functions in your newÂ PHPUnit Test Case file by writing appropriate tests for the relevant functions.
- Run theÂ PHPUnit Test by going toÂ Run |Â Run As |Â PHPUnit from the Menu Bar -or- right-clicking the file in PHP Explorer view and selectingÂ Run As |Â PHPUnit.