function _createCommandClass($name, $body = '') { $class = lmbCliRunner::commandToClass($name); $php = <<<EOD <?php class {$class} extends lmbCliBaseCmd { {$body} } ?> EOD; file_put_contents(LIMB_VAR_DIR . '/tmp_cmd/' . $class . '.class.php', $php); }
function testProcessCommandValidateResult_Negative() { $input = new lmbCliInput(); $output = new lmbCliOutput(); $input->read(array('foo.php', '--required_param')); $runner = new lmbCliRunner($input, $output); $runner->returnOnExit(); $file = $this->_createCommandClass('TestProcessCommandValidateResult_Negative', 'function execute() { echo "execute"; }', 'function validate() { echo "invalid"; return false; }', 'function help() { return "help"; }'); ob_start(); $runner->execute($file); $str = ob_get_contents(); ob_end_clean(); $this->assertEqual('invalidhelp', $str); }