got console stuff working, fixed a bunch of typos/syntax errors/logic issues

This commit is contained in:
tmont 2009-06-13 08:24:06 +00:00
parent c44ccb62b3
commit aa4300375e
8 changed files with 26 additions and 6 deletions

View File

@ -18,6 +18,10 @@
return true; return true;
} }
public function count() {
return 1;
}
} }
?> ?>

View File

@ -18,6 +18,10 @@
return true; return true;
} }
public function count() {
return 1;
}
} }
?> ?>

View File

@ -18,6 +18,10 @@
return false; return false;
} }
public function count() {
return 1;
}
} }
?> ?>

View File

@ -16,6 +16,10 @@
return false; return false;
} }
public function count() {
return 1;
}
} }
?> ?>

View File

@ -18,7 +18,7 @@
public function run(array $listeners) { public function run(array $listeners) {
foreach ($listeners as $listener) { foreach ($listeners as $listener) {
$listener->onBeforeTestCase($this); $listener->beforeTestCase($this);
} }
$result = new CombinedTestResult(); $result = new CombinedTestResult();
@ -28,7 +28,7 @@
} }
foreach ($listeners as $listener) { foreach ($listeners as $listener) {
$listener->onAfterTestCase($this); $listener->afterTestCase($this);
} }
return $result; return $result;
@ -38,7 +38,7 @@
$refClass = new ReflectionClass($this); $refClass = new ReflectionClass($this);
$methods = array(); $methods = array();
foreach ($refClass->getMethods() as $method) { foreach ($refClass->getMethods() as $method) {
if (preg_match('/^[\*\s]*@test\s*$/m', $method->getDocBlock())) { if (preg_match('/^[\*\s]*@test\s*$/m', $method->getDocComment())) {
$methods[] = $method; $methods[] = $method;
} }
} }

View File

@ -23,6 +23,9 @@
try { try {
$this->method->invoke($this->testCase); $this->method->invoke($this->testCase);
$testPassed = true; $testPassed = true;
foreach ($listeners as $listener) {
$listener->onTestMethodPassed($this);
}
} catch (TestFailure $failure) { } catch (TestFailure $failure) {
$this->handleTestFailure($failure); $this->handleTestFailure($failure);
} catch (Exception $e) { } catch (Exception $e) {
@ -32,7 +35,7 @@
} }
} }
$result = $this->createTestResult($this, $failure); $result = $this->createTestResult($failure);
$this->testCase->tearDown(); $this->testCase->tearDown();
foreach ($listeners as $listener) { foreach ($listeners as $listener) {

View File

@ -17,6 +17,7 @@
); );
$last = null; $last = null;
$switch = null;
foreach ($args as $arg) { foreach ($args as $arg) {
if (strpos($arg, '-') === 0) { if (strpos($arg, '-') === 0) {
$last = (substr($arg, 0, 2) === '--') ? substr($arg, 2) : substr($arg, 1); $last = (substr($arg, 0, 2) === '--') ? substr($arg, 2) : substr($arg, 1);

View File

@ -22,7 +22,7 @@
$testClass = new $testClass($testClass); $testClass = new $testClass($testClass);
if ($testClass instanceof Testable) { if ($testClass instanceof Testable) {
$tests[] = $testClasse; $tests[] = $testClass;
} }
} else if (is_dir($arg)) { } else if (is_dir($arg)) {
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($arg)) as $file) { foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($arg)) as $file) {
@ -36,7 +36,7 @@
$testClass = new $testClass($testClass); $testClass = new $testClass($testClass);
if ($testClass instanceof Testable) { if ($testClass instanceof Testable) {
$tests[] = $testClasse; $tests[] = $testClass;
} }
} }
} }