Example #1
0
 /**
  * @test
  * @return void
  */
 public function getActivePriceOptionsReturnsOnlyActivePriceOptions()
 {
     $dateYesterday = new \DateTime('yesterday');
     $dateToday = new \DateTime('today');
     $dateTomorrow = new \DateTime('tomorrow');
     $priceOption1 = new PriceOption();
     $priceOption1->setPrice(10.0);
     $priceOption1->setValidUntil($dateYesterday);
     $priceOption2 = new PriceOption();
     $priceOption2->setPrice(12.0);
     $priceOption2->setValidUntil($dateToday);
     $priceOption3 = new PriceOption();
     $priceOption3->setPrice(14.0);
     $priceOption3->setValidUntil($dateTomorrow);
     $this->subject->addPriceOptions($priceOption1);
     $this->subject->addPriceOptions($priceOption2);
     $this->subject->addPriceOptions($priceOption3);
     $expected = [];
     $expected[$dateToday->getTimestamp()] = $priceOption2;
     $expected[$dateTomorrow->getTimestamp()] = $priceOption3;
     $this->assertEquals($expected, $this->subject->getActivePriceOptions());
 }