tests/UnitTests/POData/IDSQP2/WordPress/WordPressMySQLTest.php
/**
	 * test the generated expression 3 param version of sub-string in sql server
	 */
test the generated expression 3 param version of sub-string in sql server
test the generated expression 3 param version of sub - string in sql server
function testSubString3ParamMySQL()
	{
			$serviceUri = 'http://localhost:8083/WordPressDataService.svc/';
      	    $resourcePath = 'Posts';
	        $requestUri = $serviceUri . $resourcePath;
			$hostInfo = array(
                'AbsoluteServiceUri' => new Url($serviceUri),
                'AbsoluteRequestUri' => new Url($requestUri),
                'QueryString' => '$filter=substring(Title, 1, 6) eq \'Data P\'',
                '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(SUBSTRING(post_title, 1 + 1, 6), 'Data P') = 0)", $mysqlexpression);
	}
function testSubString3ParamMySQL ( ) { $ serviceUri = 'http://localhost:8083/WordPressDataService.svc/' ; $ resourcePath = 'Posts' ; $ requestUri = $ serviceUri . $ resourcePath ; $ hostInfo = array ( 'AbsoluteServiceUri' => new Url ( $ serviceUri ) , 'AbsoluteRequestUri' => new Url ( $ requestUri ) , 'QueryString' => '$filter=substring(Title, 1, 6) eq \'Data P\'' , '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(SUBSTRING(post_title, 1 + 1, 6), 'Data P') = 0) " , $ mysqlexpression ) ; }
test the generated expression 3 param version of sub-string in sql server
test the generated expression 3 param version of sub - string in sql server