/** * Run test suite * * Execute all <b>test*</b> methods from test suite * and collect results */ public function run() { $className = get_class($this); $methods = get_class_methods($className); foreach ($methods as $testName) { if (!preg_match("/^test/", $testName)) { continue; } $this->tests++; $this->clearAppContext(); $this->setUp(); $testClosure = function () use($testName) { try { $this->{$testName}(); echo TipyCli::green('.'); } catch (AssertionFailedException $e) { $this->failures[] = $e; echo TipyCli::purple('F'); } catch (Exception $e) { $this->exceptions[] = $e; echo TipyCli::red('E'); } }; if ($this->transactionalFixtures) { TipyDAO::transaction(function () use($testName, $testClosure) { $testClosure(); TipyDAO::rollback(); }); } else { $testClosure(); } $this->tearDown(); } }