tests/UnitTests/POData/UriProcessor/QueryProcessor/SkipTokenParser/SkipTokenParserTest.php
/**
     * test the creation of nextlink from an object.
     * Test whether the buildNextPageLink function set skiptoken sub value as null when
     * it found one of the ancestor of corresponding ordering key property(ies) as null.     
     */
test the creation of nextlink from an object.
Test whether the buildNextPageLink function set skiptoken sub value as null when
it found one of the ancestor of corresponding ordering key property as null.
test the creation of nextlink from an object . Test whether the buildNextPageLink function set skiptoken sub value as null when it found one of the ancestor of corresponding ordering key property as null .
public function testCreationOfNextLink1()
    {
        $northWindMetadata = NorthWindMetadata::Create();
        $configuration = new ServiceConfiguration($northWindMetadata);
        $configuration->setEntitySetAccessRule('*', EntitySetRights::ALL);
        $providersWrapper = new ProvidersWrapper(
                                    $northWindMetadata, 
							        $this->mockQueryProvider,
                                    $configuration, 
                                    false
                                    );
        $resourceSetWrapper = $providersWrapper->resolveResourceSet('Customers');
        $resourceType = $resourceSetWrapper->getResourceType();
        $orderBy = 'Address/Address2/IsPrimary';
        $orderBy .= ',CustomerID';
        $internalOrderByInfo = OrderByParser::parseOrderByClause($resourceSetWrapper, $resourceType, $orderBy, $providersWrapper);
        $skipToken = "true, 'ALFKI'";
        $internalSkipTokenInfo = SkipTokenParser::parseSkipTokenClause($resourceType, $internalOrderByInfo, $skipToken);
        $lastObject = new Customer2();
        $lastObject->CustomerID = 'ALFKI';
        $lastObject->Address = new Address4();
        $lastObject->Address->Address2 = null;
        $nextLink = $internalSkipTokenInfo->buildNextPageLink($lastObject);
        $this->assertTrue(!is_null($nextLink));
        $this->assertEquals($nextLink, "null, 'ALFKI'");
        $lastObject = null;
        try {
            $internalSkipTokenInfo->buildNextPageLink($lastObject);
            $this->fail('An expected ODataException for failure of ReflectionProperty on dummy object while building next link');
        } catch (ODataException $odataException) {
            $this->assertStringStartsWith('internalSkipTokenInfo failed to access or initialize the property Address', $odataException->getMessage());
        }
    }
public function testCreationOfNextLink1 ( ) { $ northWindMetadata = NorthWindMetadata :: Create ( ) ; $ configuration = new ServiceConfiguration ( $ northWindMetadata ) ; $ configuration -> setEntitySetAccessRule ( '*' , EntitySetRights :: ALL ) ; $ providersWrapper = new ProvidersWrapper ( $ northWindMetadata , $ this -> mockQueryProvider , $ configuration , false ) ; $ resourceSetWrapper = $ providersWrapper -> resolveResourceSet ( 'Customers' ) ; $ resourceType = $ resourceSetWrapper -> getResourceType ( ) ; $ orderBy = 'Address/Address2/IsPrimary' ; $ orderBy .= ',CustomerID' ; $ internalOrderByInfo = OrderByParser :: parseOrderByClause ( $ resourceSetWrapper , $ resourceType , $ orderBy , $ providersWrapper ) ; $ skipToken = " true, 'ALFKI' " ; $ internalSkipTokenInfo = SkipTokenParser :: parseSkipTokenClause ( $ resourceType , $ internalOrderByInfo , $ skipToken ) ; $ lastObject = new Customer2 ( ) ; $ lastObject -> CustomerID = 'ALFKI' ; $ lastObject -> Address = new Address4 ( ) ; $ lastObject -> Address -> Address2 = null ; $ nextLink = $ internalSkipTokenInfo -> buildNextPageLink ( $ lastObject ) ; $ this -> assertTrue ( ! is_null ( $ nextLink ) ) ; $ this -> assertEquals ( $ nextLink , " null, 'ALFKI' " ) ; $ lastObject = null ; try { $ internalSkipTokenInfo -> buildNextPageLink ( $ lastObject ) ; $ this -> fail ( 'An expected ODataException for failure of ReflectionProperty on dummy object while building next link' ) ; } catch ( ODataException $ odataException ) { $ this -> assertStringStartsWith ( 'internalSkipTokenInfo failed to access or initialize the property Address' , $ odataException -> getMessage ( ) ) ; } }
test the creation of nextlink from an object.
test the creation of nextlink from an object .
//IMetadataProvider implementation //Service configuuration //Note: library will add primery key as last sort key //Here the Address2 property is null, the sort key property IsPrimary is a property of Address2 //so should emit null