Commit cbbbadbb authored by okhin's avatar okhin 🚴

Fixed the generic object test

parent 5572b798
Pipeline #2024 failed with stages
in 96 minutes and 8 seconds
...@@ -19,7 +19,11 @@ class CommandHandler ...@@ -19,7 +19,11 @@ class CommandHandler
*/ */
public function handle($command) public function handle($command)
{ {
$method = $this->getHandleMethod($command); try {
$method = $this->getHandleMethod($command);
} catch (Exception $e) {
throw new CommandNotHandledException();
}
foreach ($this->handlers as $handler) { foreach ($this->handlers as $handler) {
if (method_exists($handler, $method)) { if (method_exists($handler, $method)) {
......
...@@ -16,7 +16,7 @@ class CommandHandlerTest extends Functionaltest ...@@ -16,7 +16,7 @@ class CommandHandlerTest extends Functionaltest
public function testCommandNotHandledException() public function testCommandNotHandledException()
{ {
$this->setExpectedException('LQDN\Exception\CommandNotHandledException'); $this->setExpectedException('LQDN\Exception\CommandNotHandledException');
$this->container['command_handler']->handle(new Object()); $this->container['command_handler']->handle(new class{});
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment