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

testExportedFieldsWithJoinedStrategyAndRecursiveRelation() public method

    public function testExportedFieldsWithJoinedStrategyAndRecursiveRelation()
    {
        $query = new Query(array('type' => 'read', 'model' => $this->_gallery, 'with' => array('Parent.Parent')));
        $result = $query->export($this->_db);
        $expected = '*';
        $this->assertEqual($expected, $result['fields']);
        $query = new Query(array('type' => 'read', 'model' => $this->_gallery, 'fields' => 'Parent.name', 'with' => array('Parent.Parent')));
        $result = $query->export($this->_db);
        $expected = '{Gallery}.{id}, {Parent}.{name}';
        $this->assertEqual($expected, $result['fields']);
        $query = new Query(array('type' => 'read', 'model' => $this->_gallery, 'fields' => 'ParentOfParent.name', 'with' => array('Parent.Parent' => array('alias' => 'ParentOfParent'))));
        $result = $query->export($this->_db);
        $expected = '{Gallery}.{id}, {ParentOfParent}.{name}, {Parent}.{id}';
        $this->assertEqual($expected, $result['fields']);
    }
DatabaseTest