tests/UnitTests/POData/UriProcessor/QueryProcessor/ExpandProjectionParser/ExpandTest.php
/**
     * Test expand with multiple path segment with multiple sub path segments     
     */
Test expand with multiple path segment with multiple sub path segments
Test expand with multiple path segment with multiple sub path segments
public function testExpandWithMultipleMultilevelNavigationProperty()
    {
        $northWindMetadata = NorthWindMetadata::Create();
        $queryProvider = new NorthWindQueryProvider();
        $configuration = new ServiceConfiguration($northWindMetadata);
        $configuration->setEntitySetAccessRule('*', EntitySetRights::ALL);
        $providersWrapper = new ProvidersWrapper(
                                       $northWindMetadata, 
                                       $queryProvider, 
                                       $configuration, 
                                       false
                                     );
        $orderDetailsResourceSetWrapper = $providersWrapper->resolveResourceSet('Order_Details');
        $orderDetailResourceType = $orderDetailsResourceSetWrapper->getResourceType();
        $projectionTreeRoot = ExpandProjectionParser::parseExpandAndSelectClause(
                                                    $orderDetailsResourceSetWrapper,
                                                    $orderDetailResourceType,
                                                    null,
                                                    null,
                                                    null,
                                                    'Order/Customer, Product/Order_Details', 
                                                    null, 
                                                    $providersWrapper);
        $this->assertTrue($projectionTreeRoot->isExpansionSpecified());
        $this->assertFalse($projectionTreeRoot->isSelectionSpecified());
        $this->assertEquals(count($projectionTreeRoot->getChildNodes()), 2);
        $childNodes = $projectionTreeRoot->getChildNodes();
        $this->assertTrue(array_key_exists('Order', $childNodes));
        $this->assertTrue($childNodes['Order'] instanceof ExpandedProjectionNode);
        $this->assertTrue(array_key_exists('Product', $childNodes));
        $this->assertTrue($childNodes['Product'] instanceof ExpandedProjectionNode);
        $childNodesOfOrder = $childNodes['Order']->getChildNodes();
        $this->assertEquals(count($childNodesOfOrder), 1);
        $this->assertTrue(array_key_exists('Customer', $childNodesOfOrder));
        $this->assertTrue($childNodesOfOrder['Customer'] instanceof ExpandedProjectionNode);
        $childNodesOfProduct = $childNodes['Product']->getChildNodes();
        $this->assertEquals(count($childNodesOfProduct), 1);
        $this->assertTrue(array_key_exists('Order_Details', $childNodesOfProduct));
        $this->assertTrue($childNodesOfProduct['Order_Details'] instanceof ExpandedProjectionNode);
    }
public function testExpandWithMultipleMultilevelNavigationProperty ( ) { $ northWindMetadata = NorthWindMetadata :: Create ( ) ; $ queryProvider = new NorthWindQueryProvider ( ) ; $ configuration = new ServiceConfiguration ( $ northWindMetadata ) ; $ configuration -> setEntitySetAccessRule ( '*' , EntitySetRights :: ALL ) ; $ providersWrapper = new ProvidersWrapper ( $ northWindMetadata , $ queryProvider , $ configuration , false ) ; $ orderDetailsResourceSetWrapper = $ providersWrapper -> resolveResourceSet ( 'Order_Details' ) ; $ orderDetailResourceType = $ orderDetailsResourceSetWrapper -> getResourceType ( ) ; $ projectionTreeRoot = ExpandProjectionParser :: parseExpandAndSelectClause ( $ orderDetailsResourceSetWrapper , $ orderDetailResourceType , null , null , null , 'Order/Customer, Product/Order_Details' , null , $ providersWrapper ) ; $ this -> assertTrue ( $ projectionTreeRoot -> isExpansionSpecified ( ) ) ; $ this -> assertFalse ( $ projectionTreeRoot -> isSelectionSpecified ( ) ) ; $ this -> assertEquals ( count ( $ projectionTreeRoot -> getChildNodes ( ) ) , 2 ) ; $ childNodes = $ projectionTreeRoot -> getChildNodes ( ) ; $ this -> assertTrue ( array_key_exists ( 'Order' , $ childNodes ) ) ; $ this -> assertTrue ( $ childNodes [ 'Order' ] instanceof ExpandedProjectionNode ) ; $ this -> assertTrue ( array_key_exists ( 'Product' , $ childNodes ) ) ; $ this -> assertTrue ( $ childNodes [ 'Product' ] instanceof ExpandedProjectionNode ) ; $ childNodesOfOrder = $ childNodes [ 'Order' ] -> getChildNodes ( ) ; $ this -> assertEquals ( count ( $ childNodesOfOrder ) , 1 ) ; $ this -> assertTrue ( array_key_exists ( 'Customer' , $ childNodesOfOrder ) ) ; $ this -> assertTrue ( $ childNodesOfOrder [ 'Customer' ] instanceof ExpandedProjectionNode ) ; $ childNodesOfProduct = $ childNodes [ 'Product' ] -> getChildNodes ( ) ; $ this -> assertEquals ( count ( $ childNodesOfProduct ) , 1 ) ; $ this -> assertTrue ( array_key_exists ( 'Order_Details' , $ childNodesOfProduct ) ) ; $ this -> assertTrue ( $ childNodesOfProduct [ 'Order_Details' ] instanceof ExpandedProjectionNode ) ; }
Test expand with multiple path segment with multiple sub path segments
Test expand with multiple path segment with multiple sub path segments
//IMetadataProvider implementation //IDataServiceQueryProvider implementation (set to null) //Service configuration // $expand // $select //Expansion is specified but selection is absent //There are two child node for root //One child node (of type ExpandedProjectionNode) represents 'Order' navigation property //second child node (of type ExpandedProjectionNode) represents 'Product' navigation property //'Order' has next level navigation property //'Product' has next level navigation Property