protected function setUp() { $this->console = new Application(); $this->_input = $this->getMock('Symfony\\Component\\Console\\Input\\InputInterface'); $this->_output = $this->getMock('Symfony\\Component\\Console\\Output\\OutputInterface'); $this->_server = $this->getMockBuilder('Deployer\\Server\\ServerInterface')->disableOriginalConstructor()->getMock(); $this->_env = new Environment(); $this->deployer = new Deployer($this->console, $this->_input, $this->_output); Context::push(new Context($this->_server, $this->_env, $this->_input, $this->_output)); }
protected function setUp() { $this->console = new Application(); $this->_input = $this->getMock('Symfony\\Component\\Console\\Input\\InputInterface'); $this->_output = $this->getMock('Symfony\\Component\\Console\\Output\\OutputInterface'); $this->_server = $this->getMockBuilder('Deployer\\Server\\ServerInterface')->disableOriginalConstructor()->getMock(); $this->_env = new Environment(); $this->_env->set("local_path", __DIR__ . '/../fixture/app'); $this->_env->set("remote_path", "/home/www"); $this->deployer = new Deployer($this->console, $this->_input, $this->_output); Context::push(new Context($this->_server, $this->_env, $this->_input, $this->_output)); }
/** * Test create lazy ask password getter */ public function testCreateLazyAskPasswordGetter() { $lazyGetter = AskPasswordGetter::createLazyGetter(); $this->assertInstanceOf('Deployer\\Server\\Password\\CallablePasswordGetter', $lazyGetter); $context = $this->getMock('Deployer\\Task\\Context', ['getInput', 'getOutput'], [], '', false); $context->expects($this->any())->method('getInput')->will($this->returnValue($this->input)); $context->expects($this->any())->method('getOutput')->will($this->returnValue($this->output)); // Push own context Context::push($context); $lazyGetter->getPassword('host', 'user'); // Pop own context Context::pop(); }