Skip to content

Commit

Permalink
Used different skipif conditions for these two tests that require AE …
Browse files Browse the repository at this point in the history
…connections (#977)
  • Loading branch information
yitam authored Apr 24, 2019
1 parent a3456cd commit ee3c85a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 27 deletions.
31 changes: 20 additions & 11 deletions test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,32 @@ Verifies that the problem is no longer reproducible.
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_mid-refactor.inc'); ?>
<?php
if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv')) {
die("PDO driver cannot be loaded; skipping test.\n");
}

require_once("MsSetup.inc");
require_once("MsCommon_mid-refactor.inc");

// 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 (! $conn) {
die("Error: could not connect during SKIPIF!");
}

if (!isAEQualified($conn)) {
die("skip - AE feature not supported in the current environment.");
}
?>
--FILE--
<?php
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);
Expand Down
36 changes: 20 additions & 16 deletions test/functional/sqlsrv/srv_569_query_varcharmax.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,25 @@ Verifies that the problem is no longer reproducible.
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_versions_old.inc'); ?>
<?php
if (! extension_loaded("sqlsrv")) {
die("skip extension not loaded");
}

require_once('MsCommon.inc');

// 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) {
die("Error: could not connect during SKIPIF!");
}

if (!AE\isQualified($conn)) {
die("skip - AE feature not supported in the current environment.");
}
?>
--FILE--
<?php

Expand All @@ -19,22 +37,8 @@ function verifyFetchError()

require_once('MsCommon.inc');

// 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'));
$connectionOptions = array("Database" => $database, "UID" => $userName, "PWD" => $userPassword, 'ColumnEncryption' => 'Enabled');
$conn = sqlsrv_connect($server, $connectionOptions);
if ($conn === false) {
fatalError("Failed to connect to $server.");
Expand Down

0 comments on commit ee3c85a

Please sign in to comment.