Пример #1
0
 public function testDateTimeModified()
 {
     $dateTime = "2015-09-27 17:37:19";
     $dateTimeObject = new \DateTime($dateTime);
     $test = new \Timing();
     $test->setId(3)->setDateTime($dateTime);
     $this->asserttrue($test->isModified(), "The datetime has been set the first time and need to be modified!");
     $test->save();
     $test->setDateTime($dateTime);
     $this->assertfalse($test->isModified(), "The datetime has been marked as modified, although it was provided with the same datetime string as before!");
     $dateTimeObject->modify('+4 hours');
     $test->setDateTime($dateTimeObject);
     $this->asserttrue($test->isModified(), "The time has been not modified!");
     $test->save();
     $dateTimeObject->modify('+7 days');
     $test->setDateTime($dateTimeObject);
     $this->asserttrue($test->isModified(), "The date has been not modified!");
     $test->save();
     $test->setDateTime(null);
     $this->asserttrue($test->isModified(), "The datetime has been not modified and not set to null!");
     $test->save();
     $this->assertnull($test->getDateTime(), "The datetime was not set to null!");
     $test->setDateTime($dateTimeObject);
     $this->asserttrue($test->isModified(), "The datetime has not been modified!");
     $test->save();
 }