public function testNakedExpression() { $db = new Persistence_SQL($this->db->connection); $m = new Model($db, false); $m->addExpression('x', '2+3'); $m->tryLoadAny(); $this->assertEquals(5, $m['x']); }
public function testTryLoadAny() { $a = ['types' => [['date' => '2013-02-20']]]; $this->setDB($a); $db = new Persistence_SQL($this->db->connection); $m = new Model($db, ['table' => 'types']); $m->addField('date', ['type' => 'date', 'dateTimeClass' => '\\atk4\\data\\tests\\MyDate']); $m->tryLoadAny(); $this->assertTrue($m['date'] instanceof MyDate); }
/** * Model is not associated with any database - persistence should be set. * * @expectedException Exception */ public function testException3() { $m = new Model(); $m->tryLoadAny(); }