Post modules, themes or any other code you want to share with the community.

Moderator: Developers

Group-Office Developer
Group-Office Developer
Posts: 214
Joined: Tue Apr 20, 2004 1:45 pm
Location: Vienna, Austria


Postby ComSubVie » Fri Feb 11, 2005 6:39 pm

I've played a bit with PHPUnit Testcases, and I think this is a good way to ensure stable & mostly bugfree code if we *really* use it. To make a start I have added the directory phpUnit to CVS, which currently contains two files:
  • index.php is the TestSuite. It loads all testcases from the phpUnit directory, and executes all test_* functions from all classes that implement PHPUnit_TestCase.
  • button.php contains all tests for the button control class. I think this is the most simple class GO has implemented, but there is a lot of tests for this class - and some tests for invalid parameters aren't implemented yet (because the class itself doesn't check if action contains "-characters and so on).
Feel free to take a look at these files and implement your own testcases. If I have some time (which I haven't ;)) I'll add testcases for the whole framework, but I think for clean programming it may be useful to make correct use of the UnitTests. That means: first implement the testcases, and finally implement the class so that all tests pass.

I know that it isn't simple to get yourself to write testcases or documentation or something similar which has no direct seeable effect on the project, but if correctly done it can make your life easier.

And: If you write your testcases first, that means that it is "documented" what the class should do, and when you finished the implementation you do not need to test it, because you've already done that ;)

Who is online

Users browsing this forum: No registered users and 2 guests