use Peridot\Concurrency\Runner\StreamSelect\IO\Worker; use Peridot\Configuration; use Peridot\Core\Suite; use Peridot\Core\Test; use Symfony\Component\Console\Output\BufferedOutput; describe('ConcurrentReporter', function () { beforeEach(function () { $configuration = new Configuration(); $this->output = new BufferedOutput(); $this->emitter = new EventEmitter(); $this->reporter = new ConcurrentReporter($configuration, $this->output, $this->emitter); }); beforeEach(function () { $suite = new Suite('description', function () { }); $suite->setFile(__FILE__); $this->emitter->emit('suite.start', [$suite]); $this->test = new Test('description'); $this->test->setFile(__FILE__); $this->exception = new \Peridot\Concurrency\Runner\StreamSelect\Model\Exception(); }); context('when the test.passed event is emitted', function () { beforeEach(function () { $this->emitter->emit('test.passed', [$this->test]); }); it('should be set the test property of the entry', function () { expect($this->reporter->getSuites())->to->have->deep->property('[' . __FILE__ . '][0][test]', $this->test); }); it('should have a null value for an exception', function () { expect($this->reporter->getSuites())->to->have->deep->property('[' . __FILE__ . '][0][exception]', null); });
/** * Create a Suite based on the state of the Context. * * @param $description * @param callable $fn * @param $pending * @return Suite */ private function createSuite($description, callable $fn, $pending) { $suite = new Suite($description, $fn); if ($pending !== null) { $suite->setPending($pending); } $suite->setFile($this->file); $suite->setEventEmitter($this->getEventEmitter()); return $suite; }