public function testOnDispatchWithException() { $errorMessage = 'Missing route matches; unsure how to retrieve action'; $event = $this->getMock('Zend\\Mvc\\MvcEvent'); $exception = $this->getMock('Magento\\Setup\\Exception', ['getCode'], [$errorMessage]); $event->expects($this->once())->method('getRouteMatch')->willThrowException($exception); $this->consoleLogger->expects($this->once())->method('log')->with($errorMessage); $this->controller->onDispatch($event); }