tests/UnitTests/POData/UriProcessor/QueryProcessor/ExpandProjectionParser/ExpandTest.php
/**
     * Test case for testing empty expand and select clause     
     */
Test case for testing empty expand and select clause
Test case for testing empty expand and select clause
public function testEmptyExpandAndSelect()
    {
        $northWindMetadata = NorthWindMetadata::Create();
        $queryProvider = new NorthWindQueryProvider();
        $configuration = new ServiceConfiguration($northWindMetadata);
        $configuration->setEntitySetAccessRule('*', EntitySetRights::ALL);
        $providersWrapper = new ProvidersWrapper(
                                       $northWindMetadata, 
                                       $queryProvider, 
                                       $configuration, 
                                       false
                                     );
        $customersResourceSetWrapper = $providersWrapper->resolveResourceSet('Customers');
        $customerResourceType = $customersResourceSetWrapper->getResourceType();
        $projectionTreeRoot = ExpandProjectionParser::parseExpandAndSelectClause(
                                                    $customersResourceSetWrapper,
                                                    $customerResourceType,
                                                    null,
                                                    null,
                                                    null,
                                                    null, 
                                                    null, 
                                                    $providersWrapper);
        $this->assertNull($projectionTreeRoot->getPropertyName());
        $this->assertNull($projectionTreeRoot->getResourceProperty());
        $this->assertNotNull($projectionTreeRoot->getResourceSetWrapper());
        $this->assertNotNull($projectionTreeRoot->getResourceType());
        $this->assertEquals(count($projectionTreeRoot->getChildNodes()), 0);
        $this->assertEquals($projectionTreeRoot->getResourceSetWrapper()->getName(), $customersResourceSetWrapper->getName());
        $this->assertEquals($projectionTreeRoot->getResourceType()->getName(), $customerResourceType->getName());
        $this->assertFalse($projectionTreeRoot->isExpansionSpecified());
        $this->assertFalse($projectionTreeRoot->isSelectionSpecified());
        $this->assertTrue($projectionTreeRoot->canSelectAllProperties());
        $this->assertFalse($projectionTreeRoot->canSelectAllImmediateProperties());
    }
public function testEmptyExpandAndSelect ( ) { $ northWindMetadata = NorthWindMetadata :: Create ( ) ; $ queryProvider = new NorthWindQueryProvider ( ) ; $ configuration = new ServiceConfiguration ( $ northWindMetadata ) ; $ configuration -> setEntitySetAccessRule ( '*' , EntitySetRights :: ALL ) ; $ providersWrapper = new ProvidersWrapper ( $ northWindMetadata , $ queryProvider , $ configuration , false ) ; $ customersResourceSetWrapper = $ providersWrapper -> resolveResourceSet ( 'Customers' ) ; $ customerResourceType = $ customersResourceSetWrapper -> getResourceType ( ) ; $ projectionTreeRoot = ExpandProjectionParser :: parseExpandAndSelectClause ( $ customersResourceSetWrapper , $ customerResourceType , null , null , null , null , null , $ providersWrapper ) ; $ this -> assertNull ( $ projectionTreeRoot -> getPropertyName ( ) ) ; $ this -> assertNull ( $ projectionTreeRoot -> getResourceProperty ( ) ) ; $ this -> assertNotNull ( $ projectionTreeRoot -> getResourceSetWrapper ( ) ) ; $ this -> assertNotNull ( $ projectionTreeRoot -> getResourceType ( ) ) ; $ this -> assertEquals ( count ( $ projectionTreeRoot -> getChildNodes ( ) ) , 0 ) ; $ this -> assertEquals ( $ projectionTreeRoot -> getResourceSetWrapper ( ) -> getName ( ) , $ customersResourceSetWrapper -> getName ( ) ) ; $ this -> assertEquals ( $ projectionTreeRoot -> getResourceType ( ) -> getName ( ) , $ customerResourceType -> getName ( ) ) ; $ this -> assertFalse ( $ projectionTreeRoot -> isExpansionSpecified ( ) ) ; $ this -> assertFalse ( $ projectionTreeRoot -> isSelectionSpecified ( ) ) ; $ this -> assertTrue ( $ projectionTreeRoot -> canSelectAllProperties ( ) ) ; $ this -> assertFalse ( $ projectionTreeRoot -> canSelectAllImmediateProperties ( ) ) ; }
Test case for testing empty expand and select clause
Test case for testing empty expand and select clause
//IMetadataProvider implementation //IDataServiceQueryProvider implementation (set to null) //Service configuration //check with empty expand/select option // $expand // $select //The root of tree represents the details identifed by the request uri path //PropertyName and ResourceProperty must be null for root //There is no child node for root //Since no expansion and selection applied, the corresponding flag will be false //No selection means we need to return all properties of the resource type identifed by the request uri path //selectsubtree flag should be true //flag for SelectionOfImmediate properties will be true only if select include '*'