setReporter() public method

Set the name of the reporter to use
public setReporter ( string $reporter )
$reporter string
Esempio n. 1
0
 /**
  * Load and run Suites and Tests
  *
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->eventEmitter->emit('peridot.execute', [$input, $output]);
     $this->eventEmitter->emit('peridot.reporters', [$input, $this->factory]);
     if ($input->getOption('reporters')) {
         $this->listReporters($output);
         return 0;
     }
     if ($reporter = $input->getOption('reporter')) {
         $this->configuration->setReporter($reporter);
     }
     $this->eventEmitter->emit('peridot.load', [$this, $this->configuration]);
     return $this->getResult();
 }
<?php

use Peridot\Configuration;
use Peridot\Concurrency\Environment\Reader;
describe('Reader', function () {
    beforeEach(function () {
        $configuration = new Configuration();
        //write config to environment
        $configuration->setDsl(__FILE__);
        $configuration->setGrep('*.test.php');
        $configuration->setPath('/path/to/tests');
        $configuration->setReporter('reporter');
        $configuration->disableColors();
        $configuration->stopOnFailure();
        $this->configuration = $configuration;
        $this->reader = new Reader(new Configuration());
    });
    describe('->getConfiguration()', function () {
        it('should fetch a configuration object populated by environment', function () {
            $config = $this->reader->getConfiguration();
            expect($config->getDsl())->to->equal($this->configuration->getDsl());
            expect($config->getGrep())->to->equal($this->configuration->getGrep());
            expect($config->getPath())->to->equal($this->configuration->getPath());
            expect($config->getReporter())->to->equal($this->configuration->getReporter());
            expect($config->areColorsEnabled())->to->equal($this->configuration->areColorsEnabled());
            expect($config->shouldStopOnFailure())->to->equal($this->configuration->shouldStopOnFailure());
        });
    });
});
 /**
  * Configures Peridot to use Peridot\Concurrency\SuiteLoader
  * if the concurrent option is set. This plugin forces the use of the concurrent reporter
  * to ensure consistent and readable results.
  *
  * @return void
  */
 public function onPeridotLoad(Command $command, CoreConfiguration $config)
 {
     if (!$this->isConcurrencyEnabled()) {
         return;
     }
     $processes = $this->getInput()->getOption('processes');
     if ($processes) {
         $this->getConfiguration()->setProcesses((int) $processes);
     }
     $this->configureCommand($command);
     $config->setReporter('concurrent');
 }