Skip to content

Commit ee3c85a

Browse files
authored
Used different skipif conditions for these two tests that require AE connections (microsoft#977)
1 parent a3456cd commit ee3c85a

File tree

2 files changed

+40
-27
lines changed

2 files changed

+40
-27
lines changed

test/functional/pdo_sqlsrv/pdo_569_query_varcharmax.phpt

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,32 @@ Verifies that the problem is no longer reproducible.
55
--ENV--
66
PHPT_EXEC=true
77
--SKIPIF--
8-
<?php require('skipif_mid-refactor.inc'); ?>
8+
<?php
9+
if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv')) {
10+
die("PDO driver cannot be loaded; skipping test.\n");
11+
}
12+
13+
require_once("MsSetup.inc");
14+
require_once("MsCommon_mid-refactor.inc");
15+
16+
// This test requires to connect with the Always Encrypted feature
17+
// First check if the system is qualified to run this test
18+
$dsn = getDSN($server, null);
19+
$conn = new PDO($dsn, $uid, $pwd);
20+
if (! $conn) {
21+
die("Error: could not connect during SKIPIF!");
22+
}
23+
24+
if (!isAEQualified($conn)) {
25+
die("skip - AE feature not supported in the current environment.");
26+
}
27+
?>
928
--FILE--
1029
<?php
1130
require_once("MsSetup.inc");
1231
require_once("MsCommon_mid-refactor.inc");
1332

1433
try {
15-
// This test requires to connect with the Always Encrypted feature
16-
// First check if the system is qualified to run this test
17-
$dsn = getDSN($server, null);
18-
$conn = new PDO($dsn, $uid, $pwd);
19-
if (!isAEQualified($conn)) {
20-
echo "Done\n";
21-
return;
22-
}
23-
unset($conn);
24-
2534
// Now connect with ColumnEncryption enabled
2635
$connectionInfo = "ColumnEncryption = Enabled;";
2736
$conn = new PDO("sqlsrv:server = $server; database=$databaseName; $connectionInfo", $uid, $pwd);

test/functional/sqlsrv/srv_569_query_varcharmax.phpt

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,25 @@ Verifies that the problem is no longer reproducible.
55
--ENV--
66
PHPT_EXEC=true
77
--SKIPIF--
8-
<?php require('skipif_versions_old.inc'); ?>
8+
<?php
9+
if (! extension_loaded("sqlsrv")) {
10+
die("skip extension not loaded");
11+
}
12+
13+
require_once('MsCommon.inc');
14+
15+
// This test requires to connect with the Always Encrypted feature
16+
// First check if the system is qualified to run this test
17+
$options = array("Database" => $database, "UID" => $userName, "PWD" => $userPassword);
18+
$conn = sqlsrv_connect($server, $options);
19+
if ($conn === false) {
20+
die("Error: could not connect during SKIPIF!");
21+
}
22+
23+
if (!AE\isQualified($conn)) {
24+
die("skip - AE feature not supported in the current environment.");
25+
}
26+
?>
927
--FILE--
1028
<?php
1129

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

2038
require_once('MsCommon.inc');
2139

22-
// This test requires to connect with the Always Encrypted feature
23-
// First check if the system is qualified to run this test
24-
$options = array("Database" => $database, "UID" => $userName, "PWD" => $userPassword);
25-
$conn = sqlsrv_connect($server, $options);
26-
if ($conn === false) {
27-
fatalError("Failed to connect to $server.");
28-
}
29-
30-
if (!AE\isQualified($conn)) {
31-
echo "Done\n";
32-
return;
33-
}
34-
sqlsrv_close($conn);
35-
3640
// Now connect with ColumnEncryption enabled
37-
$connectionOptions = array_merge($options, array('ColumnEncryption' => 'Enabled'));
41+
$connectionOptions = array("Database" => $database, "UID" => $userName, "PWD" => $userPassword, 'ColumnEncryption' => 'Enabled');
3842
$conn = sqlsrv_connect($server, $connectionOptions);
3943
if ($conn === false) {
4044
fatalError("Failed to connect to $server.");

0 commit comments

Comments
 (0)