public static function earlyInitialize() { $classLoader = new UniversalClassLoader(); $classLoader->registerNamespace('Stagehand\\TestRunner', array(__DIR__ . '/../../..', __DIR__ . '/../../../../examples')); $classLoader->registerPrefix('Stagehand_TestRunner_', __DIR__ . '/../../../../examples'); $classLoader->register(); self::$applicationContext = new TestApplicationContext(); self::$applicationContext->setComponentFactory(new TestComponentFactory()); self::$applicationContext->setEnvironment(new self()); self::$applicationContext->setPlugin(PluginRepository::findByPluginID(PHPUnitPlugin::getPluginID())); ApplicationContext::setInstance(self::$applicationContext); $container = new Container(); $transformation = new Transformation($container); $transformation->transformToContainerParameters(); ApplicationContext::getInstance()->getComponentFactory()->setContainer($container); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { if (!class_exists(Compiler::COMPILED_CONTAINER_NAMESPACE . '\\PHPUnitContainer')) { $output->writeln('<error>Please run the following command before running the ' . $this->getName() . ' command:</error>' . PHP_EOL . PHP_EOL . ' <info>testrunner compile</info>'); return 1; } $container = $this->createContainer(); ApplicationContext::getInstance()->getComponentFactory()->setContainer($container); ApplicationContext::getInstance()->setComponent('environment', ApplicationContext::getInstance()->getEnvironment()); ApplicationContext::getInstance()->setComponent('input', $input); ApplicationContext::getInstance()->setComponent('output', $output); ApplicationContext::getInstance()->setComponent('plugin', PluginRepository::findByPluginID(PHPUnitPlugin::getPluginID())); ApplicationContext::getInstance()->createComponent('preparer')->prepare(); $collector = ApplicationContext::getInstance()->createComponent('collector'); $collector->setRecursive(true); define('PHPUnit_MAIN_METHOD', __METHOD__); $command = new \Stagehand\TestRunner\CLI\TestRunnerApplication\Command\PHPUnitPassthroughCommand\Command($collector, ApplicationContext::getInstance()->createComponent('test_target_repository')); if ($input->getOption('phpunit-help')) { return $command->run(array_merge($this->removeTestRunnerArguments($_SERVER['argv'], array('--phpunit-help')), array('--help')), false); } return $command->run($this->removeTestRunnerArguments($_SERVER['argv']), false); }
/** * @return string */ protected function getPluginID() { return PHPUnitPlugin::getPluginID(); }
protected function getPlugin() { return PluginRepository::findByPluginID(PHPUnitPlugin::getPluginID()); }
protected function getParameterPrefix() { return PHPUnitPlugin::getPluginID(); }
public static function getConfigurationID() { return strtolower(PHPUnitPlugin::getPluginID()); }
public function getAlias() { return strtolower(PHPUnitPlugin::getPluginID()); }