protected function expectsEvent($eventClassName)
{
Event::listen($eventClassName, function ($event) use($eventClassName) {
$this->firedEvents[] = $eventClassName;
});
$this->beforeApplicationDestroyed(function () use($eventClassName) {
$firedEvents = isset($this->firedEvents) ? $this->firedEvents : [];
if (!in_array($eventClassName, $firedEvents)) {
throw new Exception("Event {$eventClassName} not fired");
}
});
}