public function testHasCommand() { CommandRegistry::register('test', function () { }); $this->assertTrue(CommandRegistry::hasCommand('test')); $this->assertFalse(CommandRegistry::hasCommand('testabc')); }
/** * Run custom command if exists * * @param array $command * * @return boolean */ protected function runCustomCommand($command) { if (!CommandRegistry::hasCommand($command['command'])) { throw new BadMethodCallException('Command "' . $command['command'] . '" not found'); } $customCommand = CommandRegistry::getCommand($command['command']); array_unshift($command['params'], $this->image); call_user_func_array($customCommand, $command['params']); return true; }
/** * @expectedException BadMethodCallException */ public function testExceptionHasCommandParamWrong() { CommandRegistry::hasCommand(''); }