From c5b6540498e8828621ac5aa2c37c6f1392bd9950 Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Fri, 26 Apr 2019 16:30:15 -0700 Subject: [PATCH] Fixed failing tests (#981) --- .../pdo_sqlsrv/pdo_569_query_varcharmax.phpt | 21 +++++++++-------- .../pdo_sqlsrv/pdo_construct_attr_errors.phpt | 5 +++- .../sqlsrv/srv_569_query_varcharmax.phpt | 23 +++++++++---------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt b/test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt index 671cbc26..16947da0 100644 --- a/test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt +++ b/test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt @@ -5,7 +5,7 @@ Verifies that the problem is no longer reproducible. --ENV-- PHPT_EXEC=true --SKIPIF-- - + --FILE-- setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $tableName = 'pdoTestTable_569'; dropTable($conn, $tableName); - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + if ($qualified && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $tsql = "CREATE TABLE $tableName ([c1] varchar(max) COLLATE Latin1_General_BIN2 ENCRYPTED WITH (ENCRYPTION_TYPE = deterministic, ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256', COLUMN_ENCRYPTION_KEY = AEColumnKey))"; } else { $tsql = "CREATE TABLE $tableName ([c1] varchar(max))"; diff --git a/test/functional/pdo_sqlsrv/pdo_construct_attr_errors.phpt b/test/functional/pdo_sqlsrv/pdo_construct_attr_errors.phpt index a27bdc39..a31974d9 100644 --- a/test/functional/pdo_sqlsrv/pdo_construct_attr_errors.phpt +++ b/test/functional/pdo_sqlsrv/pdo_construct_attr_errors.phpt @@ -73,12 +73,15 @@ function invalidCredentials() $options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); $error1 = "*Login failed for user \'*\'."; $error2 = "*Login timeout expired*"; + $error3 = "*Could not open a connection to SQL Server*"; try { $conn = new PDO("sqlsrv:server = $server; database = $database;", $user, $passwd, $options); echo "Should have failed to connect\n"; } catch (PDOException $e) { - if (fnmatch($error1, $e->getMessage()) || fnmatch($error2, $e->getMessage())) { + if (fnmatch($error1, $e->getMessage()) || + fnmatch($error2, $e->getMessage()) || + fnmatch($error3, $e->getMessage())) { ; // matched at least one of the expected error messages } else { echo "invalidCredentials()\n"; diff --git a/test/functional/sqlsrv/srv_569_query_varcharmax.phpt b/test/functional/sqlsrv/srv_569_query_varcharmax.phpt index 314ec54c..6d4bab35 100644 --- a/test/functional/sqlsrv/srv_569_query_varcharmax.phpt +++ b/test/functional/sqlsrv/srv_569_query_varcharmax.phpt @@ -5,7 +5,7 @@ Verifies that the problem is no longer reproducible. --ENV-- PHPT_EXEC=true --SKIPIF-- - + --FILE-- 'Enabled')); -$conn = sqlsrv_connect($server, $connectionOptions); -if ($conn === false) { - fatalError("Failed to connect to $server."); + // Now connect with ColumnEncryption enabled + $connectionOptions = array_merge($options, array('ColumnEncryption' => 'Enabled')); + $conn = sqlsrv_connect($server, $connectionOptions); + if ($conn === false) { + fatalError("Failed to connect to $server."); + } } $tableName = 'srvTestTable_569'; dropTable($conn, $tableName); -if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { +if ($qualified && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $tsql = "CREATE TABLE $tableName ([c1] varchar(max) COLLATE Latin1_General_BIN2 ENCRYPTED WITH (ENCRYPTION_TYPE = deterministic, ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256', COLUMN_ENCRYPTION_KEY = AEColumnKey))"; } else { $tsql = "CREATE TABLE $tableName ([c1] varchar(max))";