lithium\tests\cases\data\ModelTest::testFindFirst PHP Method

testFindFirst() public method

public testFindFirst ( )
    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()));
    }
ModelTest