tests for command factory created

This commit is contained in:
Claudio Zizza
2014-12-07 23:00:55 +01:00
parent 5e43c4e044
commit 5b63f4b5d0
2 changed files with 58 additions and 0 deletions
+3
View File
@@ -43,14 +43,17 @@ class Factory
// try a custom command
$className = 'Command\\' . $commandName;
// TODO use a custom exception
if (!class_exists($className)) {
throw new Exception('Command "' . $commandName . '" not found.');
}
}
/** @var AbstractCommand $instance */
// TODO dependencies like $config should be injected into constructor
$instance = new $className;
if (! $instance instanceOf AbstractCommand) {
// TODO use a custom exception
throw new Exception('The command ' . $commandName . ' must be an instance of Mage\Command\AbstractCommand.');
}