/** * @group core */ public function testRun() { $events = array(); $this->dispatcher->addListener('suite.before', function ($e) use(&$events) { $events[] = $e->getName(); }); $this->dispatcher->addListener('suite.after', function ($e) use(&$events) { $events[] = $e->getName(); }); $runner = new \Codeception\PHPUnit\Runner(); $runner->setPrinter(new PHPUnit_TextUI_ResultPrinter($this->dispatcher)); $this->suiteman->run($runner, new \PHPUnit_Framework_TestResult(), array('colors' => false, 'steps' => true, 'debug' => false)); $this->assertEquals($events, array('suite.before', 'suite.after')); }
public function run(\PHPUnit_Framework_TestResult $result, $options) { $runner = new \Codeception\PHPUnit\Runner(); $runner->setPrinter(new \Codeception\PHPUnit\ResultPrinter\UI($this->dispatcher, $options)); $this->dispatcher->dispatch('suite.before', new Event\Suite($this->suite)); $runner->doEnhancedRun($this->suite, $result, array_merge(array('convertErrorsToExceptions' => true), $options)); $this->dispatcher->dispatch('suite.after', new Event\Suite($this->suite)); return $runner; }