Skip to content

Fixed failing tests #981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Verifies that the problem is no longer reproducible.
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_mid-refactor.inc'); ?>
<?php require('skipif.inc'); ?>
--FILE--
<?php
require_once("MsSetup.inc");
Expand All @@ -16,21 +16,22 @@ try {
// 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;
$qualified = isAEQualified($conn);

if ($qualified) {
unset($conn);

// Now connect with ColumnEncryption enabled
$connectionInfo = "ColumnEncryption = Enabled;";
$conn = new PDO("sqlsrv:server = $server; database=$databaseName; $connectionInfo", $uid, $pwd);
}
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);

$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))";
Expand Down
5 changes: 4 additions & 1 deletion test/functional/pdo_sqlsrv/pdo_construct_attr_errors.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
23 changes: 11 additions & 12 deletions test/functional/sqlsrv/srv_569_query_varcharmax.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Verifies that the problem is no longer reproducible.
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_versions_old.inc'); ?>
<?php require('skipif.inc'); ?>
--FILE--
<?php

Expand All @@ -27,24 +27,23 @@ if ($conn === false) {
fatalError("Failed to connect to $server.");
}

if (!AE\isQualified($conn)) {
echo "Done\n";
return;
}
sqlsrv_close($conn);
$qualified = AE\isQualified($conn);
if ($qualified) {
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.");
// 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))";
Expand Down