I'm looking for a way how to run a testcase multiple times with different setting.
I'm testing a database access class (dozens of test methods), and want to test it in "normal mode" and then in "debug mode". Both modes must produce the same test results.
Is there any possibility to do that in the testcase setting? Or overriding the run() method? I don't want to write the test twice, of course :)
Thank you
edit: GOT IT!
public function run(PHPUnit_Framework_TestResult $result = NULL)
{
if ($result === NULL) {
$result = $this->createResult();
}
/**
* Run the testsuite multiple times with different debug level
*/
$this->debugLevel = 0;
print "Setting debug level to: " . $this->debugLevel . PHP_EOL;
$result->run($this);
$this->debugLevel = 8;
print "Setting debug level to: " . $this->debugLevel . PHP_EOL;
$result->run($this);
$this->debugLevel = 16;
print "Setting debug level to: " . $this->debugLevel . PHP_EOL;
$result->run($this);
return $result;
}
public function setUp()
{
parent::setUp();
$this->myclass->setOptions('debug', $this->debugLevel);
}