tests/UnitTests/POData/UriProcessor/UriProcessorTest.php
/**
     * Test request uri for row count ($count)     
     * DataServiceVersion and MaxDataServiceVersion should be >= 2.0 for $count
     */
Test request uri for row count ($count)
DataServiceVersion and MaxDataServiceVersion should be >= 2.0 for $count
Test request uri for row count ( $count ) DataServiceVersion and MaxDataServiceVersion should be > = 2 . 0 for $count
public function testUriProcessorForCountRequest1()
    {
        $hostInfo = array(
            'AbsoluteRequestUri' => new Url('http://localhost:8083/NorthWindDataService.svc/Customers/$count'),
            'AbsoluteServiceUri' => new Url('http://localhost:8083/NorthWindDataService.svc'),
            'QueryString' => null,
            'DataServiceVersion' => new Version(1, 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 failure of capability negotiation over DataServiceVersion has not been thrown');
        } catch (ODataException $ex) {
            $this->assertStringStartsWith("Request version '1.0' is not supported for the request payload. The only supported version is '2.0", $ex->getMessage(), $ex->getTraceAsString());
        }
        $hostInfo = array(
            'AbsoluteRequestUri' => new Url('http://localhost:8083/NorthWindDataService.svc/Customers/$count'),
            'AbsoluteServiceUri' => new Url('http://localhost:8083/NorthWindDataService.svc'),
            'QueryString' => null,
            'DataServiceVersion' => new Version(2, 0),
            'MaxDataServiceVersion' => new Version(1, 0),
        );
        $host = new ServiceHostTestFake($hostInfo);
        $dataService = new NorthWindService2();
        $dataService->setHost($host);
        try {
            $dataService->handleRequest();
            $this->fail('An expected ODataException for failure of capability negoitation over MaxDataServiceVersion has not been thrown');
        } catch (ODataException $ex) {
            $this->assertStringStartsWith("Request version '1.0' is not supported for the request payload. The only supported version is '2.0", $ex->getMessage());
        }
    }
public function testUriProcessorForCountRequest1 ( ) { $ hostInfo = array ( 'AbsoluteRequestUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc/Customers/$count' ) , 'AbsoluteServiceUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc' ) , 'QueryString' => null , 'DataServiceVersion' => new Version ( 1 , 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 failure of capability negotiation over DataServiceVersion has not been thrown' ) ; } catch ( ODataException $ ex ) { $ this -> assertStringStartsWith ( " Request version '1.0' is not supported for the request payload. The only supported version is '2.0 " , $ ex -> getMessage ( ) , $ ex -> getTraceAsString ( ) ) ; } $ hostInfo = array ( 'AbsoluteRequestUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc/Customers/$count' ) , 'AbsoluteServiceUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc' ) , 'QueryString' => null , 'DataServiceVersion' => new Version ( 2 , 0 ) , 'MaxDataServiceVersion' => new Version ( 1 , 0 ) , ) ; $ host = new ServiceHostTestFake ( $ hostInfo ) ; $ dataService = new NorthWindService2 ( ) ; $ dataService -> setHost ( $ host ) ; try { $ dataService -> handleRequest ( ) ; $ this -> fail ( 'An expected ODataException for failure of capability negoitation over MaxDataServiceVersion has not been thrown' ) ; } catch ( ODataException $ ex ) { $ this -> assertStringStartsWith ( " Request version '1.0' is not supported for the request payload. The only supported version is '2.0 " , $ ex -> getMessage ( ) ) ; } }
Test request uri for row count ($count)
 DataServiceVersion and MaxDataServiceVersion should be >= 2.0 for $count
Test request uri for row count ( $count ) DataServiceVersion and MaxDataServiceVersion should be > = 2 . 0 for $count
//Test $count with DataServiceVersion < 2.0 //Test $count with MaxDataServiceVersion < 2.0