Building acceptence tests and more DB thoughts

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

Back to the database unit/web subclasses.

I need the similar subclass in both unit and web trees. Is there any non-repetitive way to subclass both with the same additions? (Short of hacking the simpletest base classes)

I tried to migrate the common code out to an include file and then include that file within the body of the class, but tha's not allowed syntacicly....
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Rather than using inheritance, instantiate a "DatabaseUnitTestCase" object in the test case:

Code: Select all

$this->sandbox =& new DatabaseSandbox;
..and call sandbox setUp/tearDown in the test case setUp/tearDown methods.

Inheritance often leads you into problems exactly like this one.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

McGruff wrote:Rather than using inheritance, instantiate a "DatabaseUnitTestCase" object in the test case:

Code: Select all

$this->sandbox =& new DatabaseSandbox;
..and call sandbox setUp/tearDown in the test case setUp/tearDown methods.

Inheritance often leads you into problems exactly like this one.
I had started with that but it wasn't working. I think I can go back to it now that I've identified the other "hidden" method calls for setting up some test cases (inlining parts of invoke/run).
Post Reply