This script has no goal to replace PEAR::PHPUnit or any existing PEAR unit test process. Main goal is to help developers to test their api (all or partial list) in a very simple way (visual), and in very quick steps.
Why this script, when PEAR::PHPUnit exists ? Creates a full unit tests is long and difficult for most of the developers, and you've to know PHPUnit package. Here with my script, you don't need to know any other package, just your own is enough. Time to write test protocol can be count in minutes rather than hours. Of course it does not replace a full PHPUnit regression tests series.
Have a look on two examples below, to see how easy it is to implement, and found some errors.
In date of this article (2004-12-08), the PEAR::Auth_PrefManager2 package is still in alpha stage (version 2.0.1dev1).
When i've choosen to have a look on it, to see if it could help me in my new projects, i've
discovered quickly a bug with the Array Container
(bug#2885).
Easy to find, but it could be avoid by package-leader (no offense, it's not the purpose of this article).
Let's have a look to see how we can test this package API. For the demonstration, i've only
coded the factory method (see Source Code [3]).
First you've to change the main file (see Source Code [1]):
Second you've to adds your test cases in a file such as Source Code [2]:
The factory method is defined at line 20, and will be static call (default is not static), line 21. The first parameter of factory method is defined on line 22, (used the Array Container).
That's all to do; easy isn't it ? Now, have a look on browser output when you'll run the simple_api_tests.php (see source Code [1]) and tell me what is the error in this package. If you don't have the solution : read details on bug#2885.
In date of this article (2004-12-08), the PEAR::Net_UserAgent_Detect package is in stable stage (version 2.0.1).
This second example is very similar to previous (see Source Code [4]) for api implementation. I let you discover the notice error in getQuirk() method, and my solution to fix it: bug#2919.
If you want to see all API (tested or not), let the line 34 of source code [1] inactive, otherwise if you want only the API declared into the getTestCase() function, un-comment the line 34.
That conclude this brief presentation, of a simple script (not a package proposal) that may
help many of us to find all basic errors in quick steps.
Hope it could help you !!!