tests/UnitTests/POData/UriProcessor/UriProcessorTest.php
/**
     * If paging is enabled for a resource set, then the uri 
     * processor should generate orderinfo irrespective of
     * whether $top or $orderby is specified or not.
     * 
     * Request DataServiceVersion => 1.0
     * Request MaxDataServiceVersion => 2.0
     */
If paging is enabled for a resource set, then the uri
processor should generate orderinfo irrespective of
whether $top or $orderby is specified or not.


If paging is enabled for a resource set then the uri processor should generate orderinfo irrespective of whether $top or $orderby is specified or not .
public function testUriProcessorForResourcePageInfo1()
    {
        $hostInfo = array(
            'AbsoluteRequestUri' => new Url('http://localhost:8083/NorthWindDataService.svc/Customers'),
            '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);
        $uriProcessor = $dataService->handleRequest();
        $requestDescription = $uriProcessor->getRequest();
        $this->assertNotNull($requestDescription);
        $this->assertEquals($requestDescription->getTopCount(), 5);
        $internalOrderByInfo = $requestDescription->getInternalOrderByInfo();
        $this->assertNotNull($internalOrderByInfo);
        $pathSegments = $internalOrderByInfo->getOrderByPathSegments();
        $this->assertNotNull($pathSegments);
        $this->assertTrue(is_array($pathSegments));
        $this->assertEquals(count($pathSegments), 2);
        $this->assertTrue($pathSegments[0] instanceof OrderByPathSegment);
        $subPathSegments = $pathSegments[0]->getSubPathSegments();
        $this->assertNotNull($subPathSegments);
        $this->assertTrue(is_array($subPathSegments));
        $this->assertEquals(count($subPathSegments), 1);
        $this->assertTrue($subPathSegments[0] instanceof OrderBySubPathSegment);
        $this->assertEquals($subPathSegments[0]->getName(), 'CustomerID');
        $this->assertTrue($pathSegments[1] instanceof OrderByPathSegment);
        $subPathSegments = $pathSegments[1]->getSubPathSegments();
        $this->assertNotNull($subPathSegments);
        $this->assertTrue(is_array($subPathSegments));
        $this->assertEquals(count($subPathSegments), 1);
        $this->assertTrue($subPathSegments[0] instanceof OrderBySubPathSegment);
        $this->assertEquals($subPathSegments[0]->getName(), 'CustomerGuid');
    }
public function testUriProcessorForResourcePageInfo1 ( ) { $ hostInfo = array ( 'AbsoluteRequestUri' => new Url ( 'http://localhost:8083/NorthWindDataService.svc/Customers' ) , '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 ) ; $ uriProcessor = $ dataService -> handleRequest ( ) ; $ requestDescription = $ uriProcessor -> getRequest ( ) ; $ this -> assertNotNull ( $ requestDescription ) ; $ this -> assertEquals ( $ requestDescription -> getTopCount ( ) , 5 ) ; $ internalOrderByInfo = $ requestDescription -> getInternalOrderByInfo ( ) ; $ this -> assertNotNull ( $ internalOrderByInfo ) ; $ pathSegments = $ internalOrderByInfo -> getOrderByPathSegments ( ) ; $ this -> assertNotNull ( $ pathSegments ) ; $ this -> assertTrue ( is_array ( $ pathSegments ) ) ; $ this -> assertEquals ( count ( $ pathSegments ) , 2 ) ; $ this -> assertTrue ( $ pathSegments [ 0 ] instanceof OrderByPathSegment ) ; $ subPathSegments = $ pathSegments [ 0 ] -> getSubPathSegments ( ) ; $ this -> assertNotNull ( $ subPathSegments ) ; $ this -> assertTrue ( is_array ( $ subPathSegments ) ) ; $ this -> assertEquals ( count ( $ subPathSegments ) , 1 ) ; $ this -> assertTrue ( $ subPathSegments [ 0 ] instanceof OrderBySubPathSegment ) ; $ this -> assertEquals ( $ subPathSegments [ 0 ] -> getName ( ) , 'CustomerID' ) ; $ this -> assertTrue ( $ pathSegments [ 1 ] instanceof OrderByPathSegment ) ; $ subPathSegments = $ pathSegments [ 1 ] -> getSubPathSegments ( ) ; $ this -> assertNotNull ( $ subPathSegments ) ; $ this -> assertTrue ( is_array ( $ subPathSegments ) ) ; $ this -> assertEquals ( count ( $ subPathSegments ) , 1 ) ; $ this -> assertTrue ( $ subPathSegments [ 0 ] instanceof OrderBySubPathSegment ) ; $ this -> assertEquals ( $ subPathSegments [ 0 ] -> getName ( ) , 'CustomerGuid' ) ; }
If paging is enabled for a resource set, then the uri
 processor should generate orderinfo irrespective of
 whether $top or $orderby is specified or not.
If paging is enabled for a resource set then the uri processor should generate orderinfo irrespective of whether $top or $orderby is specified or not .
//Test for generation of orderinfo for resource set //with request DataServiceVersion 1.0 //Page size is 5, so take count is 5 //order info is required for pagination //Customer has two keys