function testPassArgvToAction() { $input = new lmbCliInput(); $output = new lmbCliResponse(); $input->strictMode(false); $input->read(array('foo.php', $cmd = $this->_randomName(), 'foo', '--dry-run', '-c', 'bar')); $runner = new lmbCliRunner($input, $output); $runner->setCommandSearchPath($this->tmp_dir); $runner->returnOnExit(); $runner->throwOnError(); $this->_createCommandClass($cmd, 'function foo($argv){var_dump($argv);}'); ob_start(); $runner->execute(); $str = ob_get_contents(); ob_end_clean(); $expected = <<<EOD array(3) { [0]=> string(9) "--dry-run" [1]=> string(2) "-c" [2]=> string(3) "bar" } EOD; $this->assertEqual($expected, $str); }
function testUseRelaxedMode() { $argv = array('foo.php', 'arg1', '--opt1', 'arg2', 'arg3'); $cli = new lmbCliInput(); $cli->strictMode(false); $this->assertTrue($cli->read($argv)); $this->assertTrue($cli->hasOption('opt1')); $this->assertEqual($cli->getArguments(), array('arg1', 'arg2', 'arg3')); }