public function testTimestampSave() { $a = ['types' => [['date' => '']]]; $this->setDB($a); $db = new Persistence_SQL($this->db->connection); $m = new Model($db, ['table' => 'types']); $m->addField('ts', ['actual' => 'date', 'type' => 'date']); $m->loadAny(); $m['ts'] = new \DateTime('2012-02-30'); $m->save(); // stores valid date. $this->assertEquals(['types' => [1 => ['id' => 1, 'date' => '2012-03-01']]], $this->getDB()); }
/** * Model is not associated with any database - persistence should be set. * * @expectedException Exception */ public function testException5() { $m = new Model(); $m->loadAny(); }