コード例 #1
0
ファイル: MoneyRangeTest.php プロジェクト: netteam/ddd
 public function testCurrencyWhenMaxIsNull()
 {
     $range = new MoneyRange(Money::USD(123.45), null);
     $this->assertEquals('USD', $range->currency());
 }
コード例 #2
0
ファイル: Money.php プロジェクト: netteam/ddd
 /**
  * Assert that current and given money objects have same currencies.
  *
  * @param  \NetTeam\DDD\ValueObject\Money $other
  * @throws \DomainException
  */
 private function assertSameCurrency(Money $other)
 {
     if ($this->currency() !== $other->currency()) {
         throw new \DomainException(sprintf('Money object must have same currencies, current is %s and given %s', $this->currency(), $other->currency()));
     }
 }
コード例 #3
0
ファイル: MoneyTest.php プロジェクト: netteam/ddd
 public function testIsNegative()
 {
     $m1 = new Money(-12, 'EUR');
     $m2 = new Money(0, 'EUR');
     $m3 = new Money(12, 'EUR');
     $this->assertTrue($m1->isNegative());
     $this->assertFalse($m2->isNegative());
     $this->assertFalse($m3->isNegative());
 }