tests/UnitTests/POData/UriProcessor/UriProcessorTest.php
/**
     * $inline count is not supported for protocol version V1
     */
$inline count is not supported for protocol version V1
$inline count is not supported for protocol version V1
public function testUriProcessorForInlineCount1()
    {
        $baseUri = 'http://localhost:8083/NorthWindDataService.svc/';
        $resourcePath = 'Products(11)/Order_Details';
        $hostInfo = array(
            'AbsoluteRequestUri' => new Url($baseUri . $resourcePath),
            'AbsoluteServiceUri' => new Url($baseUri),
            'QueryString' => '$inlinecount=allpages&$top=3',
            'DataServiceVersion' => new Version(2, 0),
            'MaxDataServiceVersion' => new Version(2, 0),
        );
        $host = new ServiceHostTestFake($hostInfo);
        $dataService = new NorthWindServiceV1();
        $dataService->setHost($host);
        try {
            $dataService->handleRequest();
            $this->fail('An expected ODataException for $inlinecount query option with V1 configured service has not been thrown');
        } catch (ODataException $ex) {
            $this->assertStringStartsWith('The response requires that version 2.0 of the protocol be used, but the MaxProtocolVersion of the data service is set to 1.0', $ex->getMessage());
        }
    }
public function testUriProcessorForInlineCount1 ( ) { $ baseUri = 'http://localhost:8083/NorthWindDataService.svc/' ; $ resourcePath = 'Products(11)/Order_Details' ; $ hostInfo = array ( 'AbsoluteRequestUri' => new Url ( $ baseUri . $ resourcePath ) , 'AbsoluteServiceUri' => new Url ( $ baseUri ) , 'QueryString' => '$inlinecount=allpages&$top=3' , 'DataServiceVersion' => new Version ( 2 , 0 ) , 'MaxDataServiceVersion' => new Version ( 2 , 0 ) , ) ; $ host = new ServiceHostTestFake ( $ hostInfo ) ; $ dataService = new NorthWindServiceV1 ( ) ; $ dataService -> setHost ( $ host ) ; try { $ dataService -> handleRequest ( ) ; $ this -> fail ( 'An expected ODataException for $inlinecount query option with V1 configured service has not been thrown' ) ; } catch ( ODataException $ ex ) { $ this -> assertStringStartsWith ( 'The response requires that version 2.0 of the protocol be used, but the MaxProtocolVersion of the data service is set to 1.0' , $ ex -> getMessage ( ) ) ; } }
$inline count is not supported for protocol version V1
$inline count is not supported for protocol version V1
//Paging is enabled this cause skiptoken to be included //in the response, thus reponse version become 2.0 //But if $top is specified and its value is less than page size //then we don't need to include $skiptoken in response //so response version is 1.0. //If the paging is enabled and protocol to be used is V1 //then a request (without a $top or $top value > pagesize) //cause the repsonse version of 2.0 to be used, but server //will throw error as protocol version is set to V1. //This error will be thrown from ProcessSkipAndTopCount function. //$inlinecount is a V2 feature, so with configured version of V1 //ProcessCount will thorow error. //We are adding a $top value (< pagesize) with $inlinecount so that //version error will be thrown from ProcessCount instead of from //ProcessSkipAndTopCount