function it_emits_account_opened_event(EventDispatcherInterface $dispatcher) { $dispatcher->dispatch(AccountOpenedEnvelope::getEventName(), Argument::type(AccountOpenedEnvelope::class))->shouldBeCalled(); $events = new EventCollection([new AccountOpenedEvent(AccountNumber::fromString('123ABC'))]); $this->beConstructedWith($dispatcher); $this->emit($events); }
public static function getSubscribedEvents() { return [AccountOpenedEnvelope::getEventName() => 'onAccountOpened', MoneyWereDepositedEnvelope::getEventName() => 'onMoneyWereDeposited', MoneyWereWithdrawnEnvelope::getEventName() => 'onMoneyWereWithdrawn']; }