atk4\data\tests\TypecastingTest::testTimestampSave PHP Method

testTimestampSave() public method

public testTimestampSave ( )
    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());
    }