getDate() public method

Gets the calculation date.
public getDate ( ) : DateTime
return DateTime The calculation date.
示例#1
0
 /**
  * {@inheritdoc}
  */
 public function resolveAmounts(TaxableInterface $taxable, Context $context)
 {
     $date = $context->getDate();
     $rates = $this->resolveRates($taxable, $context);
     $amounts = [];
     foreach ($rates as $rate) {
         $amounts[] = $rate->getAmount($date);
     }
     return $amounts;
 }
示例#2
0
 /**
  * @covers ::__construct
  *
  * @uses \CommerceGuys\Tax\Resolver\Context::getCustomerAddress
  * @uses \CommerceGuys\Tax\Resolver\Context::getStoreAddress
  * @uses \CommerceGuys\Tax\Resolver\Context::getCustomerTaxNumber
  * @uses \CommerceGuys\Tax\Resolver\Context::getStoreRegistrations
  * @uses \CommerceGuys\Tax\Resolver\Context::getDate
  */
 public function testConstructor()
 {
     $customerAddress = $this->getMockBuilder('CommerceGuys\\Addressing\\Model\\Address')->getMock();
     $storeAddress = $this->getMockBuilder('CommerceGuys\\Addressing\\Model\\Address')->getMock();
     $date = new \DateTime('2014-10-10');
     $context = new Context($customerAddress, $storeAddress, '0123', ['DE'], $date);
     $this->assertSame($customerAddress, $context->getCustomerAddress());
     $this->assertSame($storeAddress, $context->getStoreAddress());
     $this->assertEquals('0123', $context->getCustomerTaxNumber());
     $this->assertEquals(['DE'], $context->getStoreRegistrations());
     $this->assertSame($date, $context->getDate());
 }