function storeEvents($assert) { $store = new MemoryEventStore(); $application = new CommandQueryApplication($store); $application->handle(new Foo2('that')); $assert($store->allEvents(), [new Fooed('that happened')]); }
function projectEvents($assert) { $store = new MemoryEventStore(); $application = new CommandQueryApplication($store); $store->append(new Fooed5('that happened'), 'foo'); $bar = $application->handle(new Bar()); $assert($bar->fooed, ['So that happened']); }