public function testDatabaseOperationsShouldBailOutIfTheEventHandlerReturnsFalse($operation, $dbOperation, $eventName)
{
// Arrange
$connPool = m::mock(Pool::class);
$mapper = m::mock(DataMapper::class . '[parseToDocument,getCollection]', [$connPool]);
$collection = m::mock(Collection::class);
$entity = m::mock();
$mapper->shouldAllowMockingProtectedMethods();
// Expect
$mapper->shouldReceive('parseToDocument')->with($entity)->never();
$mapper->shouldReceive('getCollection')->andReturn($collection);
$collection->shouldReceive($dbOperation)->never();
/* "Mocks" the fireEvent to return false and bail the operation */
$this->expectEventToBeFired($eventName, $entity, true, false);
// Act
$result = $mapper->{$operation}($entity);
// Assert
$this->assertFalse($result);
}