Added skipif and modified the check of isLocaleSupported()

This commit is contained in:
Jenny Tam 2017-12-20 10:18:46 -08:00
parent 720346f459
commit 6b209526cd
10 changed files with 66 additions and 28 deletions

View file

@ -98,6 +98,8 @@ function startTest($testName)
*/
function endTest($testName)
{
// reset the utf-8 flag
setUTF8Data(false);
echo "Test \"$testName\" completed successfully.\n";
}

View file

@ -6,18 +6,25 @@ Validates that a prepared statement can be successfully executed more than once.
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_versions_old.inc'); ?>
<?php
// locale must be set before 1st connection
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
require('skipif_versions_old.inc');
?>
--FILE--
<?php
require_once('MsCommon.inc');
function prepareAndExecute($noPasses)
{
$testName = "Statement - Prepare and Execute";
startTest($testName);
setup();
$conn1 = AE\connect();
if (useUTF8Data()) {
$conn1 = AE\connect(array('CharacterSet'=>'UTF-8'));
} else {
$conn1 = AE\connect();
}
$tableName = 'TC34test';
AE\createTestTable($conn1, $tableName);
@ -80,20 +87,38 @@ function prepareAndExecute($noPasses)
dropTable($conn1, $tableName);
sqlsrv_close($conn1);
endTest($testName);
}
// locale must be set before 1st connection
if (!isWindows()) {
setUTF8Data(true);
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
$testName = "Statement - Prepare and Execute";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isLocaleSupported()) {
try {
setUTF8Data(false);
prepareAndExecute(5);
} catch (Exception $e) {
echo $e->getMessage();
}
}
endTest($testName);
// test utf8
startTest($testName);
try {
setUTF8Data(true);
prepareAndExecute(5);
} catch (Exception $e) {
echo $e->getMessage();
}
setUTF8Data(false);
endTest($testName);
?>
--EXPECT--
Test "Statement - Prepare and Execute" completed successfully.
Test "Statement - Prepare and Execute" completed successfully.

View file

@ -8,10 +8,10 @@ PHPT_EXEC=true
--SKIPIF--
<?php
// locale must be set before 1st connection
if ( !isWindows() ) {
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
require('skipif_versions_old.inc');
require('skipif_versions_old.inc');
?>
--FILE--
<?php

View file

@ -5,9 +5,10 @@ PHPT_EXEC=true
--SKIPIF--
<?
// locale must be set before 1st connection
if ( !isWindows() ) {
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -104,7 +105,7 @@ $testName = "Fetch - Field Data";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
try {
setUTF8Data(false);

View file

@ -8,9 +8,10 @@ PHPT_EXEC=true
--SKIPIF--
<?
// locale must be set before 1st connection
if ( !isWindows() ) {
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -161,7 +162,7 @@ $testName = "Fetch - Array";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
try {
setUTF8Data(false);
fetchRow(1, 4);

View file

@ -10,7 +10,7 @@ PHPT_EXEC=true
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
require('skipif_versions_old.inc');
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -28,7 +28,7 @@ function fetchRow($minFetchMode, $maxFetchMode)
setup();
$tableName = 'TC45test';
if (useUTF8Data()) {
$conn1 = AE\connect(array( 'CharacterSet'=>'UTF-8' ));
$conn1 = AE\connect(array('CharacterSet'=>'UTF-8'));
} else {
$conn1 = AE\connect();
}
@ -89,7 +89,7 @@ function fetchObject($stmt, $rows, $fields, $useClass)
$obj = sqlsrv_fetch_object($stmt);
}
if ($obj === false) {
fatalError("Row $i is missing");
fatalError("In fetchObject: Row $i is missing");
}
$values[$i] = $obj;
}
@ -103,7 +103,7 @@ function fetchArray($stmt, $rows, $fields)
for ($i = 0; $i < $rows; $i++) {
$row = sqlsrv_fetch_array($stmt);
if ($row === false) {
fatalError("Row $i is missing");
fatalError("In fetchArray: Row $i is missing");
}
$values[$i] = $row;
}
@ -127,7 +127,13 @@ function checkData($rows, $fields, $actualValues, $expectedValues)
}
}
// locale must be set before 1st connection
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
$testName = "Fetch - Object";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isLocaleSupported()) {

View file

@ -7,9 +7,10 @@ PHPT_EXEC=true
--SKIPIF--
<?
// locale must be set before 1st connection
if ( !isWindows() ) {
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -94,7 +95,7 @@ $testName = "Fetch - Next Result";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
try {
setUTF8Data(false);
fetchFields();

View file

@ -7,9 +7,10 @@ can be successfully retrieved as streams.
PHPT_EXEC=true
--SKIPIF--
<?// locale must be set before 1st connection
if ( !isWindows() ) {
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -138,7 +139,7 @@ $errMessage = 'Connection with Column Encryption enabled does not support fetchi
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
try {
setUTF8Data(false);
streamRead(20, 1);

View file

@ -7,9 +7,10 @@ PHPT_EXEC=true
--SKIPIF--
<?
// locale must be set before 1st connection
if ( !isWindows() ) {
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -175,7 +176,7 @@ $errMessage = 'Connection with Column Encryption enabled does not support fetchi
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
try {
setUTF8Data(false);
streamScroll(20, 1);

View file

@ -3,11 +3,11 @@ streaming large amounts of data into a database and getting it out as a string e
--SKIPIF--
<?
// locale must be set before 1st connection
if ( !isWindows() ) {
if (!isWindows() ) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
php require('skipif.inc');
require('skipif.inc');
?>
--FILE--
<?php
@ -259,7 +259,7 @@ if (!isWindows()) {
}
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
setUTF8Data(false);
runtest();
}