tests/UnitTests/POData/UriProcessor/UriProcessorTest.php
/**
     * select and expand can be applied to only request uri identifying a resource set
     * or resource set reference.
     */
select and expand can be applied to only request uri identifying a resource set
or resource set reference.
select and expand can be applied to only request uri identifying a resource set or resource set reference .
public function testUriProcessorForSelectExpandOnNonResourceSetOrReference()
    {
        $baseUri = 'http://localhost:8083/NorthWindDataService.svc/';
        $resourcePath = 'Orders(123)/Customer/Address';
        $hostInfo = array(
            'AbsoluteRequestUri' => new Url($baseUri . $resourcePath),
            'AbsoluteServiceUri' => new Url($baseUri),
            'QueryString' => '$expand=Address2',
            'DataServiceVersion' => new Version(2, 0),
            'MaxDataServiceVersion' => new Version(2, 0),
        );
        $host = new ServiceHostTestFake($hostInfo);
        $dataService = new NorthWindService2();
        $dataService->setHost($host);
        try {
            $dataService->handleRequest();
            $this->fail('An expected ODataException for $expand on  non resource set or resource set refernce has not been thrown');
        } catch (ODataException $ex) {
            $this->assertStringStartsWith('Query option $expand cannot be applied to the requested resource', $ex->getMessage());
        }
        $baseUri = 'http://localhost:8083/NorthWindDataService.svc/';
        $resourcePath = 'Orders(123)/Customer/Address';
        $hostInfo = array(
            'AbsoluteRequestUri' => new Url($baseUri . $resourcePath),
            'AbsoluteServiceUri' => new Url($baseUri),
            'QueryString' => '$select=LineNumber',
            'DataServiceVersion' => new Version(2, 0),
            'MaxDataServiceVersion' => new Version(2, 0),
        );
        $host = new ServiceHostTestFake($hostInfo);
        $dataService = new NorthWindService2();
        $dataService->setHost($host);
        try {
            $dataService->handleRequest();
            $this->fail('An expected ODataException for $select on  non resource set or resource set refernce has not been thrown');
        } catch (ODataException $ex) {
            $this->assertStringStartsWith('Query option $select cannot be applied to the requested resource', $ex->getMessage());
        }
    }
public function testUriProcessorForSelectExpandOnNonResourceSetOrReference ( ) { $ baseUri = 'http://localhost:8083/NorthWindDataService.svc/' ; $ resourcePath = 'Orders(123)/Customer/Address' ; $ hostInfo = array ( 'AbsoluteRequestUri' => new Url ( $ baseUri . $ resourcePath ) , 'AbsoluteServiceUri' => new Url ( $ baseUri ) , 'QueryString' => '$expand=Address2' , 'DataServiceVersion' => new Version ( 2 , 0 ) , 'MaxDataServiceVersion' => new Version ( 2 , 0 ) , ) ; $ host = new ServiceHostTestFake ( $ hostInfo ) ; $ dataService = new NorthWindService2 ( ) ; $ dataService -> setHost ( $ host ) ; try { $ dataService -> handleRequest ( ) ; $ this -> fail ( 'An expected ODataException for $expand on  non resource set or resource set refernce has not been thrown' ) ; } catch ( ODataException $ ex ) { $ this -> assertStringStartsWith ( 'Query option $expand cannot be applied to the requested resource' , $ ex -> getMessage ( ) ) ; } $ baseUri = 'http://localhost:8083/NorthWindDataService.svc/' ; $ resourcePath = 'Orders(123)/Customer/Address' ; $ hostInfo = array ( 'AbsoluteRequestUri' => new Url ( $ baseUri . $ resourcePath ) , 'AbsoluteServiceUri' => new Url ( $ baseUri ) , 'QueryString' => '$select=LineNumber' , 'DataServiceVersion' => new Version ( 2 , 0 ) , 'MaxDataServiceVersion' => new Version ( 2 , 0 ) , ) ; $ host = new ServiceHostTestFake ( $ hostInfo ) ; $ dataService = new NorthWindService2 ( ) ; $ dataService -> setHost ( $ host ) ; try { $ dataService -> handleRequest ( ) ; $ this -> fail ( 'An expected ODataException for $select on  non resource set or resource set refernce has not been thrown' ) ; } catch ( ODataException $ ex ) { $ this -> assertStringStartsWith ( 'Query option $select cannot be applied to the requested resource' , $ ex -> getMessage ( ) ) ; } }
select and expand can be applied to only request uri identifying a resource set
 or resource set reference.
select and expand can be applied to only request uri identifying a resource set or resource set reference .