public function testPreInsert() { $t1 = new Table2(); $this->assertNull($t1->getCreatedAt()); $tsave = time(); $t1->save(); $this->assertEquals($t1->getCreatedAt('U'), $tsave, 'Timestampable sets created_column to time() on creation'); sleep(1); $tupdate = time(); $t1->save(); $this->assertEquals($t1->getCreatedAt('U'), $tsave, 'Timestampable does not update created_column on update'); }
public function testPreInsertManuallyUpdated() { $tcreated = time() - 10; $t1 = new Table2(); $t1->setCreatedAt($tcreated); $t1->save(); $this->assertEquals($tcreated, $t1->getCreatedAt('U'), 'Timestampable does not set created_column to time() on creation when it is set by the user'); }