Beispiel #1
0
 /**
  * Transfer a given amount to a specific member
  *
  * @param Money $amount
  * @param Member $toMember
  */
 public function transfer(Money $amount, Member $toMember)
 {
     $toMember->applyDeposit($amount);
     $this->account->withdraw($amount);
     $this->recordThat(new TransferWasMade($this->memberId, $amount, $toMember->memberId));
 }
 /**
  * @return Member
  */
 public function build()
 {
     $member = Member::withAccountBalance(Identifier::fromString($this->id), $this->name, new Email($this->email), $this->amount);
     $this->reset();
     return $member;
 }
 /**
  * @return MemberInformation
  */
 public function toMember()
 {
     return $this->toMember->information();
 }
 /**
  * @param Money $amount
  * @param Member $forMember
  */
 public function assertBalanceIs(Money $amount, Member $forMember)
 {
     $currentBalance = $forMember->information()->accountBalance()->getAmount();
     Assertion::assertTrue($forMember->information()->accountBalance()->equals($amount), "Expecting {$amount->getAmount()}, not {$currentBalance}");
 }
 /**
  * @param integer $lowerLimitAmount
  * @param Member $forMember
  * @param string $message
  */
 public static function assertBalanceIsGreaterThan($lowerLimitAmount, Member $forMember, $message = '')
 {
     TestCase::assertThat($forMember->information()->accountBalance(), self::isBalanceAmountGreaterThan($lowerLimitAmount), $message);
 }