Inheritance: extends lithium\data\Model
 public function testOverrideMeta()
 {
     $meta = MockTag::meta(array('id' => 'key'));
     $expected = 'mock-source';
     $result = $meta['connection'];
     $this->assertEqual($expected, $result);
     $expected = 'mock_tags';
     $result = $meta['source'];
     $this->assertEqual($expected, $result);
     $expected = 'key';
     $result = $meta['id'];
     $this->assertEqual($expected, $result);
 }
Beispiel #2
0
 public function testFindFirst()
 {
     MockTag::config(array('meta' => array('key' => 'id')));
     $tag = MockTag::find('first', array('conditions' => array('id' => 2)));
     $tag2 = MockTag::find(2);
     $tag3 = MockTag::first(2);
     $expected = $tag['query']->export(MockTag::connection());
     $this->assertEqual($expected, $tag2['query']->export(MockTag::connection()));
     $this->assertEqual($expected, $tag3['query']->export(MockTag::connection()));
     $tag = MockTag::find('first', array('conditions' => array('id' => 2), 'return' => 'array'));
     $expected['return'] = 'array';
     $this->assertTrue($tag instanceof Query);
     $this->assertEqual($expected, $tag->export(MockTag::connection()));
 }
 public function testFindFirst()
 {
     MockTag::config(array('meta' => array('key' => 'id')));
     $tag = MockTag::find('first', array('conditions' => array('id' => 2)));
     $tag2 = MockTag::find(2);
     $tag3 = MockTag::first(2);
     $expected = $tag['query']->export(MockTag::$connection);
     $this->assertEqual($expected, $tag2['query']->export(MockTag::$connection));
     $this->assertEqual($expected, $tag3['query']->export(MockTag::$connection));
 }
Beispiel #4
0
 public function testFindFirst()
 {
     $tag = MockTag::find('first', array('conditions' => array('id' => 2)));
     $tag2 = MockTag::find(2);
     $tag3 = MockTag::first(2);
     $this->assertEqual($tag, $tag2);
     $this->assertEqual($tag, $tag3);
 }