Beispiel #1
0
 public function testDateModified()
 {
     $date = "2015-03-28";
     $dateObject = new \DateTime($date);
     $test = new \Timing();
     $test->setId(2)->setDate($date);
     $this->asserttrue($test->isModified(), "The date has been set the first time and need to be modified!");
     $test->save();
     $test->setDate($date);
     $this->assertfalse($test->isModified(), "The date has been marked as modified, although it was provided with the same date string as before!");
     $dateObject->modify('+4 hours');
     $test->setDate($dateObject);
     $this->assertfalse($test->isModified(), "The time was modified, but not the date!");
     $dateObject->modify('+7 days');
     $test->setDate($dateObject);
     $this->asserttrue($test->isModified(), "The date has been not modified!");
     $test->save();
     $test->setDate(null);
     $this->asserttrue($test->isModified(), "The date has been not modified and not set to null!");
     $test->save();
     $this->assertnull($test->getDate(), "The date was not set to null!");
     $test->setDate($dateObject);
     $this->asserttrue($test->isModified(), "The date has not been modified!");
     $test->save();
 }