예제 #1
0
 public function testTimeModified()
 {
     $time = "17:37:19";
     $timeObject = new \DateTime($time);
     $test = new \Timing();
     $test->setId(1)->setTime($time);
     $this->asserttrue($test->isModified(), "The time has been set the first time and need to be modified!");
     $test->save();
     $test->setTime($time);
     $this->assertfalse($test->isModified(), "The time has been marked as modified, although it was provided with the same time string as before!");
     $timeObject->modify('+1 days');
     $test->setTime($timeObject);
     $this->assertfalse($test->isModified(), "The date was modified, but not the time!");
     $timeObject->modify('+7 hours');
     $test->setTime($timeObject);
     $this->asserttrue($test->isModified(), "The time has not been modified!");
     $test->save();
     $test->setTime(null);
     $this->asserttrue($test->isModified(), "The time has not been modified and not set to null!");
     $test->save();
     $this->assertnull($test->getTime(), "The time was not set to null!");
     $test->setTime($timeObject);
     $this->asserttrue($test->isModified(), "The time has not been modified!");
     $test->save();
 }