public function testShouldAllowToOverwriteArgsArray() { $event = new RunTestsProcessEvent($this->commandMock, $this->inputMock, $this->outputMock, $this->processBuilder, ['foo', 'bar']); // Set custom args, overwrite those from constructor $event->setArgs(['baz', 'ban']); // Check they are retrieved using the getter $this->assertSame(['baz', 'ban'], $event->getArgs()); }
/** * If the $xdebugIdeKey variable is set, pass it to the process as XDEBUG_CONFIG environment variable * * @param RunTestsProcessEvent $event */ public function onCommandRunTestsProcess(RunTestsProcessEvent $event) { if ($this->xdebugIdeKey) { $event->getProcessBuilder()->setEnv('XDEBUG_CONFIG', 'idekey=' . $this->xdebugIdeKey); } }
/** * Build Process instance for each testcase file * * @param string $fileName * @param array $phpunitArgs * @return Process */ protected function buildProcess($fileName, array $phpunitArgs = []) { $processBuilder = new ProcessBuilder(); $dispatcher = $this->command->getDispatcher(); $dispatcher->dispatch(CommandEvents::RUN_TESTS_PROCESS, $processEvent = new RunTestsProcessEvent($this->command, $this->input, $this->output, $processBuilder, $phpunitArgs)); $process = $processBuilder->setEnv('BROWSER_NAME', $this->input->getArgument('browser'))->setEnv('ENV', strtolower($this->input->getArgument('environment')))->setEnv('SERVER_URL', $this->input->getOption('server-url'))->setEnv('PUBLISH_RESULTS', $this->input->getOption('publish-results') ? '1' : '0')->setEnv('FIXTURES_DIR', $this->input->getOption('fixtures-dir'))->setEnv('LOGS_DIR', $this->input->getOption('logs-dir'))->setEnv('DEBUG', $this->output->isDebug() ? '1' : '0')->setPrefix(STEWARD_BASE_DIR . '/vendor/bin/phpunit')->setArguments(array_merge($processEvent->getArgs(), [$fileName]))->setTimeout(3600)->getProcess(); return $process; }