/** * @param BaseCommand $command * @param array $input * * @return CommandTester */ private function runCommandTest(BaseCommand $command, array $input = []) { $application = $this->getApplication(); $command->setApplication($application); $commandTest = new CommandTester($command); $commandTest->execute(array_merge($input, ['command' => $command->getName()]), ['decorated' => false]); return $commandTest; }
/** * {@inheritdoc} */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); if (null === $input->getArgument('branch_name')) { $input->setArgument('branch_name', $this->getHelper('git')->getActiveBranchName()); } if (null === $input->getArgument('organization')) { $input->setArgument('organization', $this->getParameter($input, 'authentication')['username']); } }
/** * Set Issue-tracker configuration. * * When no explicit configuration for the issue-tracker is set * the repository information is reused (when possible). * * @param BaseCommand $command */ private function setIssueTrackerDef(BaseCommand $command) { $issueTracker = $this->application->getConfig()->get('issue_tracker', Config::CONFIG_LOCAL, GitHelper::UNDEFINED_ADAPTER); $command->addOption('issue-adapter', 'ia', InputOption::VALUE_REQUIRED, sprintf('Adapter-name of the issue-tracker (%s)', $this->getSupportedAdapters(AdapterFactory::SUPPORT_ISSUE_TRACKER)), $issueTracker)->addOption('issue-org', 'io', InputOption::VALUE_REQUIRED, 'Name of the issue-tracker organization', $this->application->getConfig()->getFirstNotNull(['issue_project_org', 'repo_org'], Config::CONFIG_LOCAL, GitHelper::UNDEFINED_ORG))->addOption('issue-project', 'ip', InputOption::VALUE_REQUIRED, 'Repository/project name of the issue-tracker in the organization', $this->application->getConfig()->getFirstNotNull(['issue_project_name', 'repo_name'], Config::CONFIG_LOCAL, GitHelper::UNDEFINED_REPO)); }
/** * @param BaseCommand $command * @param array $input * @param array $localConfig * @param \Closure|null $helperSetManipulator * * @return CommandTester */ private function runCommandTest(BaseCommand $command, array $input = [], array $localConfig = [], $helperSetManipulator = null) { $config = new Config('/home/user', '/temp/gush', ['adapters' => ['github' => ['authentication' => ['username' => 'cordoval', 'password' => 'very-un-secret']], 'github_enterprise' => ['authentication' => ['username' => 'admins', 'password' => 'very-un-secretly']]]], '/data/repo-dir', $localConfig); $application = $this->getApplication($config, $helperSetManipulator); $command->setApplication($application); $commandTest = new CommandTester($command); $commandTest->execute(array_merge($input, ['command' => $command->getName()]), ['decorated' => false]); return $commandTest; }