getRunner() public method

public getRunner ( )
Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $runner = new runner('atoum');
     $bundles = $input->getArgument('bundles');
     if (count($bundles) > 0) {
         foreach ($bundles as $k => $bundleName) {
             $bundles[$k] = $this->extractBundleConfigurationFromKernel($bundleName);
         }
     } else {
         $bundles = $this->getContainer()->get('atoum.configuration.bundle.container')->all();
     }
     foreach ($bundles as $bundle) {
         $directories = array_filter($bundle->getDirectories(), function ($dir) {
             return is_dir($dir);
         });
         if (empty($directories)) {
             $output->writeln(sprintf('<error>There is no test found on "%s".</error>', $bundle->getName()));
         }
         foreach ($directories as $directory) {
             $runner->getRunner()->addTestsFromDirectory($directory);
         }
     }
     $defaultBootstrap = sprintf('%s/autoload.php', $this->getApplication()->getKernel()->getRootDir());
     $bootstrap = $input->getOption('bootstrap-file') ?: $defaultBootstrap;
     $this->setAtoumArgument('--bootstrap-file', $bootstrap);
     if ($input->getOption('no-code-coverage')) {
         $this->setAtoumArgument('-ncc');
     }
     if ($input->getOption('max-children-number')) {
         $this->setAtoumArgument('--max-children-number', (int) $input->getOption('max-children-number'));
     }
     $runner->run($this->getAtoumArguments());
 }
Beispiel #2
0
 /**
  * @return string
  */
 public function runAgain()
 {
     /** @var \mageekguy\atoum\writers\std\out $outputWriter */
     $outputWriter = $this->runner->getOutputWriter();
     $watcher = new ResourceWatcher();
     $onEvent = function (FilesystemEvent $event) use($watcher, $outputWriter) {
         $outputWriter->write((string) $event->getResource() . " has been modified." . PHP_EOL);
         $watcher->stop();
     };
     foreach ($this->configuration->getWatchedFiles() as $watchedFile) {
         $watcher->track($watchedFile, $watchedFile);
         $watcher->addListener($watchedFile, $onEvent);
     }
     foreach ($this->runner->getRunner()->getTestPaths() as $path) {
         $watcher->track($path, $path);
         $watcher->addListener($path, $onEvent);
     }
     $outputWriter->write('Waiting for a file to change to run the test(s)... (Use CTRL+C to stop)' . PHP_EOL);
     $watcher->start();
     return '';
 }
Beispiel #3
0
 public function testUseConfigFile()
 {
     $this->if($runner = new testedClass(uniqid()))->and($runner->setLocale($locale = new \mock\mageekguy\atoum\locale()))->then->exception(function () use($runner, &$file) {
         $runner->useConfigFile($file = uniqid());
     })->isInstanceOf('mageekguy\\atoum\\includer\\exception')->hasMessage('Unable to find configuration file \'' . $file . '\'')->mock($locale)->call('_')->withArguments('Unable to find configuration file \'%s\'')->once()->if($configFile = stream::get())->and($configFile->file_get_contents = '<?php $runner->disableCodeCoverage(); ?>')->then->boolean($runner->getRunner()->codeCoverageIsEnabled())->isTrue()->object($runner->useConfigFile((string) $configFile))->isIdenticalTo($runner)->boolean($runner->getRunner()->codeCoverageIsEnabled())->isFalse();
 }