public function testBeforeDeletionEvent(array
$event, array
$connectionData, ?string
$expectedExceptionCode = null
): void
{ $connection =
$this->
getConnectionMock($connectionData);
$cmsPageDefaultChangeSubscriber =
new CmsPageDefaultChangeSubscriber($connection);
$exceptionWasThrown = false;
try { $cmsPageDefaultChangeSubscriber->
beforeDeletion($this->
getBeforeDeleteEvent($event));
} catch (CmsException
$exception) { if ($expectedExceptionCode) { static::
assertEquals($expectedExceptionCode,
$exception->
getErrorCode());
$exceptionWasThrown = true;
} } finally { if ($expectedExceptionCode && !
$exceptionWasThrown) { static::
fail('Expected exception with code ' .
$expectedExceptionCode . ' to be thrown.'
);
} }