function reactToEvents($assert) { $application = new CommandQueryApplication(new MemoryEventStore()); $application->addListener(new StaticListener(new FooListener())); $application->handle(new Foo3('this')); $assert(FooListener::$heard, [new Fooed3('this happened')]); }