/** * Gets the manager class for the given environment. * * @param string $name Environment Name * @throws \InvalidArgumentException * @return Environment */ public function getEnvironment($name) { if (isset($this->environments[$name])) { return $this->environments[$name]; } // check the environment exists if (!$this->getConfig()->hasEnvironment($name)) { throw new \InvalidArgumentException(sprintf('The environment "%s" does not exist', $name)); } // create an environment instance and cache it $environment = new Environment($name, $this->getConfig()->getEnvironment($name)); $this->environments[$name] = $environment; $environment->setInput($this->getInput()); $environment->setOutput($this->getOutput()); return $environment; }
public function testGettingInputObject() { $this->environment->setInput($this->getMock('\\Symfony\\Component\\Console\\Input\\InputInterface')); $inputObject = $this->environment->getInput(); $this->assertInstanceOf('\\Symfony\\Component\\Console\\Input\\InputInterface', $inputObject); }