public function testLenientArgsParsingDefaultsToParentValue() { $this->parentConfig->enableLenientArgsParsing(); $this->assertTrue($this->config->isLenientArgsParsingEnabled()); $this->parentConfig->disableLenientArgsParsing(); $this->assertFalse($this->config->isLenientArgsParsingEnabled()); }
public function testRunWithLenientArgsParsing() { $rawArgs = $this->getMock('Webmozart\\Console\\Api\\Args\\RawArgs'); $parsedArgs = new Args(new ArgsFormat()); $io = $this->getMockBuilder('Webmozart\\Console\\Api\\IO\\IO')->disableOriginalConstructor()->getMock(); $parser = $this->getMock('Webmozart\\Console\\Api\\Args\\ArgsParser'); $handler = $this->getMock('stdClass', array('handle')); $config = new CommandConfig('command'); $config->setArgsParser($parser); $config->setHandler($handler); $config->enableLenientArgsParsing(); $command = new Command($config); $format = $command->getArgsFormat(); $parser->expects($this->once())->method('parseArgs')->with($this->identicalTo($rawArgs), $this->identicalTo($format), true)->willReturn($parsedArgs); $handler->expects($this->once())->method('handle')->with($parsedArgs, $io, $command)->willReturn(123); $this->assertSame(123, $command->run($rawArgs, $io)); }