lithium\tests\cases\data\source\DatabaseTest::testWithGeneration PHP Method

testWithGeneration() public method

public testWithGeneration ( )
    public function testWithGeneration()
    {
        $model = $this->_gallery;
        $options = array('type' => 'read', 'model' => $model, 'with' => array('Image.ImageTag.Tag'));
        $result = $this->_db->read(new Query($options));
        $expected = 'SELECT * FROM {mock_gallery} AS {Gallery} LEFT JOIN {mock_image} AS {Image} ';
        $expected .= 'ON {Gallery}.{id} = {Image}.{gallery_id} LEFT JOIN {mock_image_tag} AS ';
        $expected .= '{ImageTag} ON {Image}.{id} = {ImageTag}.{image_id} LEFT JOIN {mock_tag} ';
        $expected .= 'AS {Tag} ON {ImageTag}.{tag_id} = {Tag}.{id};';
        $this->assertEqual($expected, $this->_db->sql);
        $model = $this->_imageTag;
        $options = array('type' => 'read', 'model' => $model, 'with' => array('Image', 'Tag'));
        $result = $this->_db->read(new Query($options));
        $expected = 'SELECT * FROM {mock_image_tag} AS {ImageTag} LEFT JOIN {mock_image} AS ';
        $expected .= '{Image} ON {ImageTag}.{image_id} = {Image}.{id} LEFT JOIN {mock_tag} AS ';
        $expected .= '{Tag} ON {ImageTag}.{tag_id} = {Tag}.{id};';
        $this->assertEqual($expected, $this->_db->sql);
    }
DatabaseTest