tests/UnitTests/POData/IDSQP2/WordPress/WordPressMySQLTest.php
/**
	 * test the generated expression trim in sql server
	 */
test the generated expression trim in sql server
test the generated expression trim in sql server
function testSubStringTrimMySQL()
	{
        $serviceUri = 'http://localhost:8083/WordPressDataService.svc/';
        $resourcePath = 'Posts';
        $requestUri = $serviceUri . $resourcePath;
        $hostInfo = array(
            'AbsoluteServiceUri' => new Url($serviceUri),
            'AbsoluteRequestUri' => new Url($requestUri),
            'QueryString' => '$filter=trim(\'  OData PHP Producer   \') eq Title',
            'DataServiceVersion' => new Version(3, 0),
            'MaxDataServiceVersion' => new Version(3, 0)
        );
        $host = new ServiceHostTestFake($hostInfo);
        $dataService = new WordPressDataService();
        $dataService->setHost($host);
        $uriProcessor = $dataService->handleRequest();
        $this->assertNotNull($uriProcessor);
        $requestDescription = $uriProcessor->getRequest();
        $this->assertNotNull($requestDescription);
        $filterInfo = $requestDescription->getFilterInfo();
        $this->assertNotNull($filterInfo);
        $mysqlexpression = $filterInfo->getExpressionAsString();
        $this->AssertEquals("(STRCMP(TRIM('  OData PHP Producer   '), post_title) = 0)", $mysqlexpression);
	}
function testSubStringTrimMySQL ( ) { $ serviceUri = 'http://localhost:8083/WordPressDataService.svc/' ; $ resourcePath = 'Posts' ; $ requestUri = $ serviceUri . $ resourcePath ; $ hostInfo = array ( 'AbsoluteServiceUri' => new Url ( $ serviceUri ) , 'AbsoluteRequestUri' => new Url ( $ requestUri ) , 'QueryString' => '$filter=trim(\'  OData PHP Producer   \') eq Title' , 'DataServiceVersion' => new Version ( 3 , 0 ) , 'MaxDataServiceVersion' => new Version ( 3 , 0 ) ) ; $ host = new ServiceHostTestFake ( $ hostInfo ) ; $ dataService = new WordPressDataService ( ) ; $ dataService -> setHost ( $ host ) ; $ uriProcessor = $ dataService -> handleRequest ( ) ; $ this -> assertNotNull ( $ uriProcessor ) ; $ requestDescription = $ uriProcessor -> getRequest ( ) ; $ this -> assertNotNull ( $ requestDescription ) ; $ filterInfo = $ requestDescription -> getFilterInfo ( ) ; $ this -> assertNotNull ( $ filterInfo ) ; $ mysqlexpression = $ filterInfo -> getExpressionAsString ( ) ; $ this -> AssertEquals ( " (STRCMP(TRIM('  OData PHP Producer   '), post_title) = 0) " , $ mysqlexpression ) ; }
test the generated expression trim in sql server
test the generated expression trim in sql server