mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-04 00:18:56 +02:00
tests for command factory created
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user