Redaxscript\Console\Command\Install::run PHP Method

run() public method

run the command
Since: 3.0.0
public run ( string $mode = null ) : string
$mode string name of the mode
return string
    public function run($mode = null)
    {
        $parser = new Parser($this->_request);
        $parser->init($mode);
        /* run command */
        $argumentKey = $parser->getArgument(1);
        if ($argumentKey === 'database') {
            return $this->_database($parser->getOption());
        }
        if ($argumentKey === 'module') {
            return $this->_module($parser->getOption());
        }
        return $this->getHelp();
    }

Usage Example

Example #1
0
 /**
  * testModule
  *
  * @since 3.0.0
  */
 public function testModuleInvalid()
 {
     /* setup */
     $this->_request->setServer('argv', ['console.php', 'install', 'module', '--no-interaction']);
     $installCommand = new Command\Install($this->_registry, $this->_request, $this->_config);
     /* actual */
     $actual = $installCommand->run('cli');
     /* compare */
     $this->assertFalse($actual);
 }