Fixed failing tests (#981)

This commit is contained in:
Jenny Tam 2019-04-26 16:30:15 -07:00 committed by GitHub
parent e8d13896ba
commit c5b6540498
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 23 deletions

View file

@ -5,7 +5,7 @@ Verifies that the problem is no longer reproducible.
--ENV-- --ENV--
PHPT_EXEC=true PHPT_EXEC=true
--SKIPIF-- --SKIPIF--
<?php require('skipif_mid-refactor.inc'); ?> <?php require('skipif.inc'); ?>
--FILE-- --FILE--
<?php <?php
require_once("MsSetup.inc"); require_once("MsSetup.inc");
@ -16,21 +16,22 @@ try {
// First check if the system is qualified to run this test // First check if the system is qualified to run this test
$dsn = getDSN($server, null); $dsn = getDSN($server, null);
$conn = new PDO($dsn, $uid, $pwd); $conn = new PDO($dsn, $uid, $pwd);
if (!isAEQualified($conn)) { $qualified = isAEQualified($conn);
echo "Done\n";
return; if ($qualified) {
}
unset($conn); unset($conn);
// Now connect with ColumnEncryption enabled // Now connect with ColumnEncryption enabled
$connectionInfo = "ColumnEncryption = Enabled;"; $connectionInfo = "ColumnEncryption = Enabled;";
$conn = new PDO("sqlsrv:server = $server; database=$databaseName; $connectionInfo", $uid, $pwd); $conn = new PDO("sqlsrv:server = $server; database=$databaseName; $connectionInfo", $uid, $pwd);
}
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$tableName = 'pdoTestTable_569'; $tableName = 'pdoTestTable_569';
dropTable($conn, $tableName); 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))"; $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 { } else {
$tsql = "CREATE TABLE $tableName ([c1] varchar(max))"; $tsql = "CREATE TABLE $tableName ([c1] varchar(max))";

View file

@ -73,12 +73,15 @@ function invalidCredentials()
$options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); $options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
$error1 = "*Login failed for user \'*\'."; $error1 = "*Login failed for user \'*\'.";
$error2 = "*Login timeout expired*"; $error2 = "*Login timeout expired*";
$error3 = "*Could not open a connection to SQL Server*";
try { try {
$conn = new PDO("sqlsrv:server = $server; database = $database;", $user, $passwd, $options); $conn = new PDO("sqlsrv:server = $server; database = $database;", $user, $passwd, $options);
echo "Should have failed to connect\n"; echo "Should have failed to connect\n";
} catch (PDOException $e) { } 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 ; // matched at least one of the expected error messages
} else { } else {
echo "invalidCredentials()\n"; echo "invalidCredentials()\n";

View file

@ -5,7 +5,7 @@ Verifies that the problem is no longer reproducible.
--ENV-- --ENV--
PHPT_EXEC=true PHPT_EXEC=true
--SKIPIF-- --SKIPIF--
<?php require('skipif_versions_old.inc'); ?> <?php require('skipif.inc'); ?>
--FILE-- --FILE--
<?php <?php
@ -27,10 +27,8 @@ if ($conn === false) {
fatalError("Failed to connect to $server."); fatalError("Failed to connect to $server.");
} }
if (!AE\isQualified($conn)) { $qualified = AE\isQualified($conn);
echo "Done\n"; if ($qualified) {
return;
}
sqlsrv_close($conn); sqlsrv_close($conn);
// Now connect with ColumnEncryption enabled // Now connect with ColumnEncryption enabled
@ -39,12 +37,13 @@ $conn = sqlsrv_connect($server, $connectionOptions);
if ($conn === false) { if ($conn === false) {
fatalError("Failed to connect to $server."); fatalError("Failed to connect to $server.");
} }
}
$tableName = 'srvTestTable_569'; $tableName = 'srvTestTable_569';
dropTable($conn, $tableName); 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))"; $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 { } else {
$tsql = "CREATE TABLE $tableName ([c1] varchar(max))"; $tsql = "CREATE TABLE $tableName ([c1] varchar(max))";