/** * Return the result as an integer. * * @return int */ protected function getResult() { $result = new TestResult($this->eventEmitter); $this->getLoader()->load($this->configuration->getPath()); $this->factory->create($this->configuration->getReporter()); $this->runner->run($result); if ($result->getFailureCount() > 0) { return 1; } return 0; }
/** * @param Configuration $config */ public function onPeridotConfigure(Configuration $config) { $this->track($config->getPath()); }
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\OutputInterface; describe('WatcherPlugin', function () { beforeEach(function () { $this->emitter = new EventEmitter(); $this->watcher = new WatcherPlugin($this->emitter); }); context('when peridot.configure event fires', function () { it('should add the test path to tracked paths', function () { $configuration = new Configuration(); $configuration->setPath('/path/to/thing'); $this->emitter->emit('peridot.configure', [$configuration]); assert($this->watcher->getTrackedPaths()[0] == $configuration->getPath(), "should track config path"); }); }); $setupEnvironment = function () { $this->definition = new InputDefinition(); $this->environment = new Environment($this->definition, $this->emitter, []); }; context('when peridot.start event fires', function () use($setupEnvironment) { beforeEach($setupEnvironment); beforeEach(function () { $this->application = new Application($this->environment); $this->emitter->emit('peridot.start', [$this->environment, $this->application]); }); it('should add a watch option on the input definition', function () { assert($this->definition->hasOption('watch'), "input definition should have watch option"); });