/** @test */ public function it_should_open_an_account_when_a_player_has_been_registered() { $event = PlayerRegisteredStub::random(); $owner = AccountOwnerStub::create($event->aggregateId()); $account = AccountStub::create($owner, VirtualMoneyStub::zeroCoins()); $accountOpened = AccountOpenedStub::create($owner, new DateTimeImmutable()); $this->shouldSearchAccount($owner); $this->shouldPersistAccount($account); $this->shouldHandleEvent($accountOpened); $this->subscriber->notify($event); }
private function virtualMoney(array $accountInfo) { return VirtualMoneyStub::create((int) $accountInfo['amount'], new VirtualCurrency($accountInfo['currency'])); }
public static function random() { return self::create(AccountOwnerStub::random(), VirtualMoneyStub::randomCoins()); }