views:

17

answers:

1

So, I've got a little problem with my Unittests. I wrote some basisclasses for different Testcases and I want to uses some prepared test-methods.

i.e.

class ModelTestCase extends PHPUnit_Framework_TestCase {
  public function testCreateInstance() { ... }
}

class UserModelTest extends ModelTestCase {
  /**
   * (at)depends testCreateInstance
   */
  public funcion testWhatever($model) { ...}
}

Is there any trick to use it as I want or must I really write every test in every class?

A: 

It all depends on what you really want to do, your code sample is way too vague to tell that.

One option for you is to create your own setup() method in ModelTestCase (dont forget to call parent::setUp()) and do some initialization in there.

Anti Veeranna