tests/UnitTests/POData/UriProcessor/QueryProcessor/ExpandProjectionParser/SelectTest.php
/**
     * If last sub path segment specified in the select clause does not appear in the prjection tree,
     * then parser will create 'ProjectionNode' for them
     */
If last sub path segment specified in the select clause does not appear in the prjection tree,
then parser will create 'ProjectionNode' for them
If last sub path segment specified in the select clause does not appear in the prjection tree then parser will create ' ProjectionNode ' for them
public function testProjectionNodeCreation()
    {
        $northWindMetadata = NorthWindMetadata::Create();
        $queryProvider = new NorthWindQueryProvider();
        $configuration = new ServiceConfiguration($northWindMetadata);
        $configuration->setEntitySetAccessRule('*', EntitySetRights::ALL);
        $providersWrapper = new ProvidersWrapper(
                                       $northWindMetadata, 
                                       $queryProvider, 
                                       $configuration, 
                                       false
                                     );
        $ordersResourceSetWrapper = $providersWrapper->resolveResourceSet('Orders');
        $orderResourceType = $ordersResourceSetWrapper->getResourceType();
        $projectionTreeRoot = ExpandProjectionParser::parseExpandAndSelectClause(
                                                    $ordersResourceSetWrapper,
                                                    $orderResourceType,
                                                    null,
                                                    null,
                                                    null,
                                                    'Order_Details', 
                                                    'Order_Details/UnitPrice, Customer', 
                                                    $providersWrapper);
        $this->assertTrue($projectionTreeRoot->isExpansionSpecified());
        $this->assertTrue($projectionTreeRoot->isSelectionSpecified());
        $this->assertFalse($projectionTreeRoot->canSelectAllImmediateProperties());
        $this->assertFalse($projectionTreeRoot->canSelectAllProperties());
        $this->assertEquals(count($projectionTreeRoot->getChildNodes()), 2);
        $childNodes = $projectionTreeRoot->getChildNodes();
        $this->assertTrue(array_key_exists('Order_Details', $childNodes));
        $this->assertTrue(array_key_exists('Customer', $childNodes));
        $this->assertTrue($childNodes['Order_Details'] instanceof ExpandedProjectionNode);
        $this->assertTrue($childNodes['Customer'] instanceof ProjectionNode);
        $childNodes = $childNodes['Order_Details']->getChildNodes();
        $this->assertEquals(count($childNodes), 1);
        $this->assertTrue(array_key_exists('UnitPrice', $childNodes));
        $this->assertTrue($childNodes['UnitPrice'] instanceof ProjectionNode);
    }
public function testProjectionNodeCreation ( ) { $ northWindMetadata = NorthWindMetadata :: Create ( ) ; $ queryProvider = new NorthWindQueryProvider ( ) ; $ configuration = new ServiceConfiguration ( $ northWindMetadata ) ; $ configuration -> setEntitySetAccessRule ( '*' , EntitySetRights :: ALL ) ; $ providersWrapper = new ProvidersWrapper ( $ northWindMetadata , $ queryProvider , $ configuration , false ) ; $ ordersResourceSetWrapper = $ providersWrapper -> resolveResourceSet ( 'Orders' ) ; $ orderResourceType = $ ordersResourceSetWrapper -> getResourceType ( ) ; $ projectionTreeRoot = ExpandProjectionParser :: parseExpandAndSelectClause ( $ ordersResourceSetWrapper , $ orderResourceType , null , null , null , 'Order_Details' , 'Order_Details/UnitPrice, Customer' , $ providersWrapper ) ; $ this -> assertTrue ( $ projectionTreeRoot -> isExpansionSpecified ( ) ) ; $ this -> assertTrue ( $ projectionTreeRoot -> isSelectionSpecified ( ) ) ; $ this -> assertFalse ( $ projectionTreeRoot -> canSelectAllImmediateProperties ( ) ) ; $ this -> assertFalse ( $ projectionTreeRoot -> canSelectAllProperties ( ) ) ; $ this -> assertEquals ( count ( $ projectionTreeRoot -> getChildNodes ( ) ) , 2 ) ; $ childNodes = $ projectionTreeRoot -> getChildNodes ( ) ; $ this -> assertTrue ( array_key_exists ( 'Order_Details' , $ childNodes ) ) ; $ this -> assertTrue ( array_key_exists ( 'Customer' , $ childNodes ) ) ; $ this -> assertTrue ( $ childNodes [ 'Order_Details' ] instanceof ExpandedProjectionNode ) ; $ this -> assertTrue ( $ childNodes [ 'Customer' ] instanceof ProjectionNode ) ; $ childNodes = $ childNodes [ 'Order_Details' ] -> getChildNodes ( ) ; $ this -> assertEquals ( count ( $ childNodes ) , 1 ) ; $ this -> assertTrue ( array_key_exists ( 'UnitPrice' , $ childNodes ) ) ; $ this -> assertTrue ( $ childNodes [ 'UnitPrice' ] instanceof ProjectionNode ) ; }
If last sub path segment specified in the select clause does not appear in the prjection tree,
 then parser will create 'ProjectionNode' for them
If last sub path segment specified in the select clause does not appear in the prjection tree then parser will create ' ProjectionNode ' for them
//IMetadataProvider implementation //IDataServiceQueryProvider implementation (set to null) //Service configuration //test selection of properties which is not included in expand clause //1 primitve ('Order_Details/UnitPrice') and 1 link to navigation 'Customer' // $expand //$select //expand option is absent //select is applied //there are 2 child nodes for the root //The child nodes one 'ProjectionNode' Customer and one 'ExpandedProjectionNode' for 'Order' //'Order_Detials' has a child node