public function testTradeMeta() { $expected = new Meta(); $expected->table = 'trade'; $expected->class = 'Phormium\\Tests\\Models\\Trade'; $expected->database = 'testdb'; $expected->columns = array('tradedate', 'tradeno', 'price', 'quantity'); $expected->pk = array('tradedate', 'tradeno'); $expected->nonPK = array('price', 'quantity'); $actual = Trade::getMeta(); $this->assertEquals($expected, $actual); }
public function testGetPK() { $foo = new Person(); $this->assertCount(1, $foo->getPK()); $foo = new PkLess(); $this->assertCount(0, $foo->getPK()); $foo = new Trade(); $this->assertCount(2, $foo->getPK()); }
/** * @expectedException \Exception * @expectedExceptionMessage Error forming aggregate query. Column [xxx] does not exist in table [trade]. */ public function testInvalidColumn() { Trade::objects()->avg('xxx'); }