tests/UnitTests/POData/UriProcessor/QueryProcessor/SkipTokenParser/SkipTokenParserTest.php
/**
     * Test the initialzation of orderbyinfo's dummy object from the skiptoken value.
     * The orderby parser will create the dummy object, using the orderby path,
     * we will do a negative testing on GetKeyObject, by explicitly unsetting property 
     * set by orderby parser
     */
Test the initialzation of orderbyinfo's dummy object from the skiptoken value.
The orderby parser will create the dummy object, using the orderby path,
we will do a negative testing on GetKeyObject, by explicitly unsetting property
set by orderby parser
Test the initialzation of orderbyinfo ' s dummy object from the skiptoken value . The orderby parser will create the dummy object using the orderby path we will do a negative testing on GetKeyObject by explicitly unsetting property set by orderby parser
public function testInitializationOfKeyObject1()
    {
        $northWindMetadata = NorthWindMetadata::Create();
        $configuration = new ServiceConfiguration($northWindMetadata);
        $configuration->setEntitySetAccessRule('*', EntitySetRights::ALL);
        $providersWrapper = new ProvidersWrapper(
                                    $northWindMetadata, 
							        $this->mockQueryProvider,
                                    $configuration, 
                                    false
                                    );
        $resourceSetWrapper = $providersWrapper->resolveResourceSet('Order_Details');
        $resourceType = $resourceSetWrapper->getResourceType();
        $orderBy = 'Order/Customer/Rating';
        $orderBy .= ', ProductID, OrderID';
        $internalOrderByInfo = OrderByParser::parseOrderByClause($resourceSetWrapper, $resourceType, $orderBy, $providersWrapper);
        $skipToken = "12, 1234, 4567";
        $dummyObject = $internalOrderByInfo->getDummyObject();
        $this->assertTrue(!is_null($dummyObject));
        $this->assertTrue(!is_null($dummyObject->Order));
        $this->assertTrue(!is_null($dummyObject->Order->Customer));
        $this->assertTrue(is_null($dummyObject->Order->Customer->Rating));
        $dummyObject->Order->Customer = null;
        $internalSkipTokenInfo = SkipTokenParser::parseSkipTokenClause($resourceType, $internalOrderByInfo, $skipToken);
        try {
            $o = $internalSkipTokenInfo->getKeyObject();
            $this->fail('An expected ODataException for failure of ReflectionProperty on dummy object');
        } catch (ODataException $odataException) {
            $this->assertStringStartsWith('internalSkipTokenInfo failed to access or initialize the property Rating', $odataException->getMessage());
        }
    }
public function testInitializationOfKeyObject1 ( ) { $ northWindMetadata = NorthWindMetadata :: Create ( ) ; $ configuration = new ServiceConfiguration ( $ northWindMetadata ) ; $ configuration -> setEntitySetAccessRule ( '*' , EntitySetRights :: ALL ) ; $ providersWrapper = new ProvidersWrapper ( $ northWindMetadata , $ this -> mockQueryProvider , $ configuration , false ) ; $ resourceSetWrapper = $ providersWrapper -> resolveResourceSet ( 'Order_Details' ) ; $ resourceType = $ resourceSetWrapper -> getResourceType ( ) ; $ orderBy = 'Order/Customer/Rating' ; $ orderBy .= ', ProductID, OrderID' ; $ internalOrderByInfo = OrderByParser :: parseOrderByClause ( $ resourceSetWrapper , $ resourceType , $ orderBy , $ providersWrapper ) ; $ skipToken = " 12, 1234, 4567 " ; $ dummyObject = $ internalOrderByInfo -> getDummyObject ( ) ; $ this -> assertTrue ( ! is_null ( $ dummyObject ) ) ; $ this -> assertTrue ( ! is_null ( $ dummyObject -> Order ) ) ; $ this -> assertTrue ( ! is_null ( $ dummyObject -> Order -> Customer ) ) ; $ this -> assertTrue ( is_null ( $ dummyObject -> Order -> Customer -> Rating ) ) ; $ dummyObject -> Order -> Customer = null ; $ internalSkipTokenInfo = SkipTokenParser :: parseSkipTokenClause ( $ resourceType , $ internalOrderByInfo , $ skipToken ) ; try { $ o = $ internalSkipTokenInfo -> getKeyObject ( ) ; $ this -> fail ( 'An expected ODataException for failure of ReflectionProperty on dummy object' ) ; } catch ( ODataException $ odataException ) { $ this -> assertStringStartsWith ( 'internalSkipTokenInfo failed to access or initialize the property Rating' , $ odataException -> getMessage ( ) ) ; } }
Test the initialzation of orderbyinfo's dummy object from the skiptoken value.
Test the initialzation of orderbyinfo ' s dummy object from the skiptoken value .
//IMetadataProvider implementation //Service configuuration //Note: library will add primary key as last sort key //we will remove Customer object created by orderby parser, so that getKeyObject function will //fail to access the property 'Rating', since parent ($dummyObject->Order->Customer) is null