From cfa9f05533a563797242125ced4781f7daf6691d Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Wed, 3 Apr 2019 10:03:06 -0700 Subject: [PATCH] Modified to check if qualified for AE connections --- .../pdo_sqlsrv/pdo_569_query_varcharmax.phpt | 11 +++++++++++ .../sqlsrv/srv_569_query_varcharmax.phpt | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt b/test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt index e56399882..671cbc269 100644 --- a/test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt +++ b/test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt @@ -12,6 +12,17 @@ require_once("MsSetup.inc"); require_once("MsCommon_mid-refactor.inc"); try { + // This test requires to connect with the Always Encrypted feature + // First check if the system is qualified to run this test + $dsn = getDSN($server, null); + $conn = new PDO($dsn, $uid, $pwd); + if (!isAEQualified($conn)) { + echo "Done\n"; + return; + } + unset($conn); + + // Now connect with ColumnEncryption enabled $connectionInfo = "ColumnEncryption = Enabled;"; $conn = new PDO("sqlsrv:server = $server; database=$databaseName; $connectionInfo", $uid, $pwd); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); diff --git a/test/functional/sqlsrv/srv_569_query_varcharmax.phpt b/test/functional/sqlsrv/srv_569_query_varcharmax.phpt index 1a41a629d..314ec54cc 100644 --- a/test/functional/sqlsrv/srv_569_query_varcharmax.phpt +++ b/test/functional/sqlsrv/srv_569_query_varcharmax.phpt @@ -19,7 +19,22 @@ function verifyFetchError() require_once('MsCommon.inc'); -$connectionOptions = array("Database" => $database, "UID" => $userName, "PWD" => $userPassword, "ColumnEncryption" => "Enabled"); +// This test requires to connect with the Always Encrypted feature +// First check if the system is qualified to run this test +$options = array("Database" => $database, "UID" => $userName, "PWD" => $userPassword); +$conn = sqlsrv_connect($server, $options); +if ($conn === false) { + fatalError("Failed to connect to $server."); +} + +if (!AE\isQualified($conn)) { + echo "Done\n"; + return; +} +sqlsrv_close($conn); + +// 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.");