tests/UnitTests/POData/UriProcessor/QueryProcessor/SkipTokenParser/SkipTokenParserTest.php
/**
     * Test the initialization of orderby info's dummy object from the skiptoken value.
     * 1. The string properties in the key object should be utf8 decoded.
     * 2. The lexer will consider all token text as string, but when the we populate the
     *    dummy object with these values, it should be converted to appropriate type 
     *  
     */
Test the initialization of orderby info's dummy object from the skiptoken value.
1. The string properties in the key object should be utf8 decoded.
2. The lexer will consider all token text as string, but when the we populate the
dummy object with these values, it should be converted to appropriate type
Test the initialization of orderby info ' s dummy object from the skiptoken value . 1 . The string properties in the key object should be utf8 decoded . 2 . The lexer will consider all token text as string but when the we populate the dummy object with these values it should be converted to appropriate type
public function testInitializationOfKeyObject2()
    {
        $northWindMetadata = NorthWindMetadata::Create();
        $configuration = new ServiceConfiguration($northWindMetadata);
        $configuration->setEntitySetAccessRule('*', EntitySetRights::ALL);
        $providersWrapper = new ProvidersWrapper(
                                    $northWindMetadata, 
							        $this->mockQueryProvider,
                                    $configuration, 
                                    false
                                    );
        $resourceSetWrapper = $providersWrapper->resolveResourceSet('Orders');
        $resourceType = $resourceSetWrapper->getResourceType();
        $orderBy = 'ShipName asc, Price';
        $orderBy .= ', OrderID';
        $internalOrderByInfo = OrderByParser::parseOrderByClause($resourceSetWrapper, $resourceType, $orderBy, $providersWrapper);
        $skipToken = "'Antonio%20Moreno%20Taquer%C3%ADa',22.001,10365";
        $skipToken = urldecode($skipToken);
        $internalSkipTokenInfo = SkipTokenParser::parseSkipTokenClause($resourceType, $internalOrderByInfo, $skipToken);
        $keyObject = $internalSkipTokenInfo->getKeyObject();
        $this->assertTrue(!is_null($keyObject->ShipName));
        $shipName = (urldecode('Antonio%20Moreno%20Taquer%C3%ADa'));
        $this->assertEquals($shipName, $keyObject->ShipName);
        $this->assertTrue(!is_null($keyObject->Price));
        $this->assertTrue(is_float($keyObject->Price));
        $this->assertTrue(!is_null($keyObject->OrderID));
        $this->assertTrue(is_int($keyObject->OrderID));
    }
public function testInitializationOfKeyObject2 ( ) { $ northWindMetadata = NorthWindMetadata :: Create ( ) ; $ configuration = new ServiceConfiguration ( $ northWindMetadata ) ; $ configuration -> setEntitySetAccessRule ( '*' , EntitySetRights :: ALL ) ; $ providersWrapper = new ProvidersWrapper ( $ northWindMetadata , $ this -> mockQueryProvider , $ configuration , false ) ; $ resourceSetWrapper = $ providersWrapper -> resolveResourceSet ( 'Orders' ) ; $ resourceType = $ resourceSetWrapper -> getResourceType ( ) ; $ orderBy = 'ShipName asc, Price' ; $ orderBy .= ', OrderID' ; $ internalOrderByInfo = OrderByParser :: parseOrderByClause ( $ resourceSetWrapper , $ resourceType , $ orderBy , $ providersWrapper ) ; $ skipToken = " 'Antonio%20Moreno%20Taquer%C3%ADa',22.001,10365 " ; $ skipToken = urldecode ( $ skipToken ) ; $ internalSkipTokenInfo = SkipTokenParser :: parseSkipTokenClause ( $ resourceType , $ internalOrderByInfo , $ skipToken ) ; $ keyObject = $ internalSkipTokenInfo -> getKeyObject ( ) ; $ this -> assertTrue ( ! is_null ( $ keyObject -> ShipName ) ) ; $ shipName = ( urldecode ( 'Antonio%20Moreno%20Taquer%C3%ADa' ) ) ; $ this -> assertEquals ( $ shipName , $ keyObject -> ShipName ) ; $ this -> assertTrue ( ! is_null ( $ keyObject -> Price ) ) ; $ this -> assertTrue ( is_float ( $ keyObject -> Price ) ) ; $ this -> assertTrue ( ! is_null ( $ keyObject -> OrderID ) ) ; $ this -> assertTrue ( is_int ( $ keyObject -> OrderID ) ) ; }
Test the initialization of orderby info's dummy object from the skiptoken value.
Test the initialization of orderby info ' s dummy object from the skiptoken value .
//IMetadataProvider implementation //Service configuration //Note: library will add prim key as last sort key //urldecode convert the skip token to - 'Antonio Moreno Taquería',22.000,10365 //The getKeyObject should do utf8 encoding on Antonio Moreno Taquería