Ejemplo n.º 1
0
 public function testMagicFinders()
 {
     $result = MockPost::findById(5);
     $result2 = MockPost::findFirstById(5);
     $this->assertEqual($result2, $result);
     $expected = array('id' => 5);
     $this->assertEqual($expected, $result['query']->conditions());
     $this->assertEqual('read', $result['query']->type());
     $result = MockPost::findAllByFoo(13, array('order' => array('created_at' => 'desc')));
     $this->assertEmpty($result['query']->data());
     $this->assertEqual(array('foo' => 13), $result['query']->conditions());
     $this->assertEqual(array('created_at' => 'desc'), $result['query']->order());
     $this->expectException('/Method `findFoo` not defined or handled in class/');
     MockPost::findFoo();
 }
Ejemplo n.º 2
0
 public function testMagicFinders()
 {
     $result = MockPost::findById(5);
     $result2 = MockPost::findFirstById(5);
     $this->assertEqual($result2, $result);
     $expected = array('id' => 5);
     $this->assertEqual($expected, $result['query']->conditions());
     $this->assertEqual('read', $result['query']->type());
     $this->expectException('/Method findFoo not defined or handled in class/');
     MockPost::findFoo();
 }