Calculator (atoum)
NetBeans PHP Sample Application
What is Calculator?
Calculator is a simple calculator that supports basic arithmetical operations. This PHP application is created to highlight PHP features supported by NetBeans IDE.
This sample is not intended to be used in a production environment without any changes.
This sample demonstrates the following features:
- unit testing using atoum
- code coverage of project files
Requirements
Follow these before you run the sample:- Install NetBeans IDE with PHP support
- Install and configure PHP Runtime
- Install all dependencies using Composer
(click on project and invoke Composer > Install (dev))
Note: atoum can also be installed globally as PHAR file - For debugging and code coverage, Xdebug PHP extension is required
What is included?
- NetBeans PHP Application Project
Before the start
- If you want to try the sample out, follow Getting Started guidelines.
- In case if you want to try debugging features of the NetBeans IDE, follow the Debugging guidelines.
Getting Started
- For the very first run, atoum must be installed via Composer (see Requirements).
- Simply test the project. Right-click the project node and select Test. IDE will inform you about the test results (window with test results can be opened manually).
- For code coverage, open its report (right-click the project node and select Code Coverage > Show Report...) and Run All Tests if there are no data available yet. Open Calculator.php file from the list of the files to see which lines are and which lines are not tested.
- Play futher with the sample :)
Debugging
These steps should enable you the debugging option at the sample project,
if you already have PHP debugger (Xdebug)
installed and configured.
For demonstrating the PHP debugger in NetBeans, try the following:
- Open source class Calculator.php or generated Calculator.php in the editor.
- Put breakpoint on some line with PHP code.
- To debug, right-click the test class Calculator.php and select Debug.