Skip to content

Commit

Permalink
successfully moved runTest. next, runAllTests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Hirsch committed Oct 15, 2009
1 parent 777fe8a commit 161de3b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
17 changes: 17 additions & 0 deletions TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ private function commentContainsTestFlag($comment)
(strpos($comment, '@Test') !== false));
}

public function runTest($test, UnitTest $testClass, TestResult $result = null)
{
if ($result === null) {
$result = new TestResult;
}
$result->setTestName($test);
$testClass->setUp();
try {
$testClass->$test();
$result->setTestStatus('passed');
} catch (TestException $e) {
$result->setTestStatus($e->getStatus());
$result->setTestMessage($e->getMessage());
}
$testClass->tearDown();
return $result;
}


}
15 changes: 1 addition & 14 deletions UnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,7 @@ public function findTests()

public function runTest($test, TestResult $result = null)
{
if ($result === null) {
$result = new TestResult;
}
$result->setTestName($test);
$this->setUp();
try {
$this->$test();
$result->setTestStatus('passed');
} catch (TestException $e) {
$result->setTestStatus($e->getStatus());
$result->setTestMessage($e->getMessage());
}
$this->tearDown();
return $result;
return parent::runTest($test, $this, $result);
}

public function runAllTests(TestClassResult $allResults = null)
Expand Down

0 comments on commit 161de3b

Please sign in to comment.