/** * Create a job * * @param string $job The job name * * @return Job */ public function createJob($job) { $jobInstance = new Job($this->console); return $jobInstance->setFromArray($this->console->getConfig()->getJobConfiguration($job)); }
/** * Get a job mock * * @return \PHPUnit_Framework_MockObject_MockObject|Job */ protected function getJobMock($questionCallback = null) { $application = new Application(); if ($questionCallback) { $questionHelperMock = $this->getMock('\\Symfony\\Component\\Console\\Helper\\QuestionHelper', ['ask']); $questionHelperMock->expects($this->any())->method('ask')->willReturnCallback($questionCallback); $application->getHelperSet()->set($questionHelperMock); } $console = new Console(new Config()); $console->setInput(new ArrayInput([])); $console->setOutput(new ConsoleOutput(ConsoleOutput::VERBOSITY_QUIET)); $console->setDebugOutput(new ConsoleOutput(ConsoleOutput::VERBOSITY_QUIET)); $console->setApplication($application); $job = new \Netresearch\Kite\Job($console); $job->get('composer')->invalidatePackages(); return $job; }