public function testGetLastCorrectionDate() { echo "testing DROP->GetLastCorrection\n"; $date1 = \DateTime::createFromFormat('d-m-Y', '15-02-2009'); $correction1 = $this->createCorrection(10, true); $correction1->setEndDate($date1); $date2 = DateTime::createFromFormat('d-m-Y', '15-02-2010'); $correction2 = $this->createCorrection(20, false, true); $correction2->setEndDate($date2); $date3 = DateTime::createFromFormat('d-m-Y', '15-05-2010'); $correction3 = $this->createCorrection(5, true, false); $correction3->setEndDate($date3); $date4 = DateTime::createFromFormat('d-m-Y', '16-05-2014'); $correction4 = $this->createCorrection(3, false); $correction4->setEndDate($date4); $drop1 = new Drop(); $drop1->setCorrections(array($correction1, $correction2)); $this->assertEquals($date2, $drop1->getLastCorrectionDate()); $drop2 = new Drop(); $drop2->setCorrections(array($correction2, $correction3, $correction4)); $this->assertEquals($date4, $drop2->getLastCorrectionDate()); $drop3 = new Drop(); $drop3->setCorrections(array($correction4, $correction3)); $this->assertEquals($date4, $drop3->getLastCorrectionDate()); }