public function testCurrencyWhenMaxIsNull() { $range = new MoneyRange(Money::USD(123.45), null); $this->assertEquals('USD', $range->currency()); }
/** * 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())); } }
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()); }