← Back to team overview

anewt-developers team mailing list archive

Re: PHPUnit testsuites

 

Wouter Bolsterlee wrote:
Also you should watch out with inheritance. A base class can implement a method which works fine, and a subclass might *not* overload that method, it should still probably still be tested. That, or the base method should be tested well enough to account for variations in subclasses.

Good point, but I think it's not as simple as that. Many base classes are
abstract and often miss critical functionality, and cannot be instanted
directly, hence they cannot be tested directly either. Examples of this
include AnewtDatabaseConnection (misses the essential DB connectivity code)
and AnewtFormControl (misses rendering code). Only the (concrete) subclass
instances can be tested.

Try reading up on 'stubs' or mock objects. They can fill that gap quite nicely. It doesn't work for final and singleton classes however.

-- Sander



References