/** @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);
 }
예제 #2
0
 private function virtualMoney(array $accountInfo)
 {
     return VirtualMoneyStub::create((int) $accountInfo['amount'], new VirtualCurrency($accountInfo['currency']));
 }
예제 #3
0
 public static function random()
 {
     return self::create(AccountOwnerStub::random(), VirtualMoneyStub::randomCoins());
 }