Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 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());
 }
Exemplo n.º 3
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Error forming aggregate query. Column [xxx] does not exist in table [trade].
  */
 public function testInvalidColumn()
 {
     Trade::objects()->avg('xxx');
 }