public function testValueReturnsZeroIfCouponIsExpired() { $coupon = new Coupon(); $coupon->setValue(23); $coupon->setExpiresAt('2010-01-01'); $this->assertEquals(0, $coupon->getValue()); }
public function getTotal() { $netto = 0; $brutto = 0; $taxes = array(); foreach ($this->entries as $entry) { $netto += $entry->getTotalPrice(); $brutto += $entry->getTotalPriceWithTax(); foreach ($entry->getTax() as $tax) { $taxes[$tax->getName()] = $tax->getValue(); } } return array('netto' => $netto, 'brutto' => $brutto, 'amount' => $brutto - ($this->coupon ? $this->coupon->getValue() : 0) - $this->paidAmount, 'taxes' => $taxes); }