Unittesting with event listeners in Application\Module.php

I am trying to set up some unit tests. The issue I am having is that there are some event listeners in the Application\Module.php that creates a log in a database for every request the application receives.

When running unit tests using phpunit, I don’t want these listeners creating entries in the database.
How do I prevent this from happening.

namespace Application;

class Module

public function onBootstrap(MvcEvent $e) {
    $eventManager = $e->getApplication()->getEventManager();
    $moduleRouteListener = new ModuleRouteListener();
    $eventManager->attach('route', array($this, 'logRequest'));


public function logRequest($e)
      $serviceManager = $e->getApplication()->getServiceManager();


The first thing that comes to mind is overload with Mockery

Mockery overload, that solved it. Thank you so much for this @guidofaecke