From e535e85d1f7baf3cd1fe8e2a67d7e75de27cb073 Mon Sep 17 00:00:00 2001 From: yitam Date: Tue, 27 Jun 2017 13:00:07 -0700 Subject: [PATCH 01/12] modified tests for Azure testing --- test/functional/pdo_sqlsrv/isPooled.php | 4 ++-- test/functional/pdo_sqlsrv/pdo_passwords.phpt | 8 +++---- test/functional/pdo_sqlsrv/skipif_azure.inc | 2 +- test/functional/sqlsrv/skipif_azure.inc | 2 +- .../sqlsrv/sqlsrv_testConnection.phpt | 8 ++++++- .../sqlsrv/test_connectionOption.phpt | 2 +- .../sqlsrv/test_non_alpha_password.phpt | 23 ++++++++++++++----- 7 files changed, 33 insertions(+), 16 deletions(-) diff --git a/test/functional/pdo_sqlsrv/isPooled.php b/test/functional/pdo_sqlsrv/isPooled.php index 6fc9eaaf..b0be6e0e 100644 --- a/test/functional/pdo_sqlsrv/isPooled.php +++ b/test/functional/pdo_sqlsrv/isPooled.php @@ -1,10 +1,10 @@ getMessage() ); diff --git a/test/functional/pdo_sqlsrv/skipif_azure.inc b/test/functional/pdo_sqlsrv/skipif_azure.inc index f91bd45b..38de106d 100644 --- a/test/functional/pdo_sqlsrv/skipif_azure.inc +++ b/test/functional/pdo_sqlsrv/skipif_azure.inc @@ -4,7 +4,7 @@ if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv')) include 'MsCommon.inc'; if ( IsDaasMode() ) { - die("skip test in Azure"); + die("test not applicable in Azure"); } ?> diff --git a/test/functional/sqlsrv/skipif_azure.inc b/test/functional/sqlsrv/skipif_azure.inc index c0450a67..1e6bdb6c 100644 --- a/test/functional/sqlsrv/skipif_azure.inc +++ b/test/functional/sqlsrv/skipif_azure.inc @@ -6,7 +6,7 @@ if (!extension_loaded("sqlsrv")) { include 'MsCommon.inc'; if ( IsDaasMode() ) { - die("skip test in Azure"); + die("test not applicable in Azure"); } ?> \ No newline at end of file diff --git a/test/functional/sqlsrv/sqlsrv_testConnection.phpt b/test/functional/sqlsrv/sqlsrv_testConnection.phpt index 6e54786e..7c9a672d 100644 --- a/test/functional/sqlsrv/sqlsrv_testConnection.phpt +++ b/test/functional/sqlsrv/sqlsrv_testConnection.phpt @@ -1,7 +1,13 @@ --TEST-- variety of connection parameters. --SKIPIF-- - + --FILE-- false )); + $conn = Connect(array( 'MultipleActiveResultSets' => false )); if( $conn === false ) { die( print_r( sqlsrv_errors(), true )); } diff --git a/test/functional/sqlsrv/test_non_alpha_password.phpt b/test/functional/sqlsrv/test_non_alpha_password.phpt index d532c548..ed51cb4f 100644 --- a/test/functional/sqlsrv/test_non_alpha_password.phpt +++ b/test/functional/sqlsrv/test_non_alpha_password.phpt @@ -12,9 +12,20 @@ to the test database defined in MsSetup.inc sqlsrv_configure( 'WarningsReturnAsErrors', 0 ); sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL ); -require( 'MsCommon.inc' ); +function toConnect($options = array()) +{ + require 'MsSetup.inc'; + + if (!isset($options['UID']) && !isset($options['uid'])) { + $options['UID'] = $uid; + } + if (!isset($options['pwd']) && !isset($options['PWD'])) { + $options['pwd'] = $pwd; + } + return sqlsrv_connect($server, $options); +} -$conn = ConnectSpecial(array( "UID" => "test_password", "pwd" => "! ;4triou" )); +$conn = toConnect(array( "UID" => "test_password", "pwd" => "! ;4triou" )); if (!$conn) { $errors = sqlsrv_errors(); @@ -22,7 +33,7 @@ if (!$conn) } sqlsrv_close( $conn ); -$conn = ConnectSpecial(array( "UID" => "test_password2", "pwd" => "!}} ;4triou" )); +$conn = toConnect(array( "UID" => "test_password2", "pwd" => "!}} ;4triou" )); if (!$conn) { $errors = sqlsrv_errors(); @@ -30,7 +41,7 @@ if (!$conn) } sqlsrv_close( $conn ); -$conn = ConnectSpecial(array( "UID" => "test_password3", "pwd" => "! ;4triou}}" )); +$conn = toConnect(array( "UID" => "test_password3", "pwd" => "! ;4triou}}" )); if (!$conn) { $errors = sqlsrv_errors(); @@ -38,7 +49,7 @@ if (!$conn) } sqlsrv_close( $conn ); -$conn = ConnectSpecial(array( "UID" => "test_password3", "pwd" => "! ;4triou}" )); +$conn = toConnect(array( "UID" => "test_password3", "pwd" => "! ;4triou}" )); if ($conn) { echo( "Shouldn't have connected" ); @@ -51,5 +62,5 @@ print "Test successful"; ?> --EXPECTREGEX-- An unescaped right brace \(}\) was found in either the user name or password. All right braces must be escaped with another right brace \(}}\)\. -Warning: sqlsrv_close\(\) expects parameter 1 to be resource, boolean given in .+(\/|\\)test_non_alpha_password\.php on line 38 +Warning: sqlsrv_close\(\) expects parameter 1 to be resource, boolean given in .+(\/|\\)test_non_alpha_password\.php on line 49 Test successful From 44dbd78c922cfd2169e5159e2a4a33725ca9bc62 Mon Sep 17 00:00:00 2001 From: yitam Date: Tue, 27 Jun 2017 13:17:31 -0700 Subject: [PATCH 02/12] fixed connection resiliency tests --- test/functional/pdo_sqlsrv/break_pdo.php | 14 +++++++------- test/functional/sqlsrv/break.php | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/functional/pdo_sqlsrv/break_pdo.php b/test/functional/pdo_sqlsrv/break_pdo.php index f892ab60..b066ff6c 100644 --- a/test/functional/pdo_sqlsrv/break_pdo.php +++ b/test/functional/pdo_sqlsrv/break_pdo.php @@ -1,9 +1,9 @@ query( $query ); - $query="IF OBJECT_ID('tempdb.dbo.$tableName2', 'U') IS NOT NULL DROP TABLE tempdb.dbo.$tableName2"; + $query="IF OBJECT_ID('$tableName2', 'U') IS NOT NULL DROP TABLE $tableName2"; $stmt=$conn->query( $query ); } -DropTables( $server, $uid, $pwd, $tableName1, $tableName2 ); +DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ); GenerateTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ); ?> diff --git a/test/functional/sqlsrv/break.php b/test/functional/sqlsrv/break.php index 26e6a8fc..671dc48e 100644 --- a/test/functional/sqlsrv/break.php +++ b/test/functional/sqlsrv/break.php @@ -1,9 +1,9 @@ $uid, "PWD"=>$pwd ); + $connectionInfo = array( "Database"=>$dbName, "UID"=>$uid, "PWD"=>$pwd ); $conn = sqlsrv_connect( $server, $connectionInfo ); - $query="IF OBJECT_ID('tempdb.dbo.$tableName1', 'U') IS NOT NULL DROP TABLE tempdb.dbo.$tableName1"; + $query="IF OBJECT_ID('$tableName1', 'U') IS NOT NULL DROP TABLE $tableName1"; $stmt=sqlsrv_query( $conn, $query ); - $query="IF OBJECT_ID('tempdb.dbo.$tableName2', 'U') IS NOT NULL DROP TABLE tempdb.dbo.$tableName2"; + $query="IF OBJECT_ID('$tableName2', 'U') IS NOT NULL DROP TABLE $tableName2"; $stmt=sqlsrv_query( $conn, $query ); } -DropTables( $server, $uid, $pwd, $tableName1, $tableName2 ); +DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ); GenerateTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ); ?> From 49ba13879732485c6bdedbff04eff9a257e13a76 Mon Sep 17 00:00:00 2001 From: yitam Date: Tue, 27 Jun 2017 13:34:27 -0700 Subject: [PATCH 03/12] set placeholders for daasMode --- test/functional/pdo_sqlsrv/MsSetup.inc | 2 +- test/functional/sqlsrv/MsSetup.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/pdo_sqlsrv/MsSetup.inc b/test/functional/pdo_sqlsrv/MsSetup.inc index 96343778..bcc290bc 100644 --- a/test/functional/pdo_sqlsrv/MsSetup.inc +++ b/test/functional/pdo_sqlsrv/MsSetup.inc @@ -35,7 +35,7 @@ $procName = 'php_test_proc'; $fileName = 'php_test_file.dat'; $dsn = "odbc:Driver={$DriverName};Server=$server"; $connectionOptions = array(); -$daasMode = false; +$daasMode = 'DAASMODE'; $marsMode = true; $dsnMode = true; $traceEnabled = false; diff --git a/test/functional/sqlsrv/MsSetup.inc b/test/functional/sqlsrv/MsSetup.inc index 2b0f02a8..aa0078f7 100644 --- a/test/functional/sqlsrv/MsSetup.inc +++ b/test/functional/sqlsrv/MsSetup.inc @@ -20,7 +20,7 @@ $procName = "php_test_proc"; $fileName = "php_test_file.dat"; $connectionOptions = array("Database"=>$database, "UID"=>$userName, "PWD"=>$userPassword, "TraceOn"=>false); -$daasMode = false; +$daasMode = 'DAASMODE'; $marsMode = true; $traceEnabled = false; From 6e8111418d6fdfd5d87ad0f1bb704232608495e6 Mon Sep 17 00:00:00 2001 From: yitam Date: Tue, 27 Jun 2017 14:20:53 -0700 Subject: [PATCH 04/12] resiliency tests and skip azure condition --- test/functional/pdo_sqlsrv/break_pdo.php | 6 ++++-- test/functional/pdo_sqlsrv/skipif_azure.inc | 8 +++----- test/functional/sqlsrv/break.php | 6 ++++-- test/functional/sqlsrv/skipif_azure.inc | 6 ++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/functional/pdo_sqlsrv/break_pdo.php b/test/functional/pdo_sqlsrv/break_pdo.php index b066ff6c..0be99e6f 100644 --- a/test/functional/pdo_sqlsrv/break_pdo.php +++ b/test/functional/pdo_sqlsrv/break_pdo.php @@ -65,8 +65,10 @@ function BreakConnection( $conn, $conn_break ) } // Remove any databases previously created by GenerateDatabase -function DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ) +function DropTables( $server, $uid, $pwd, $tableName1, $tableName2 ) { + global $dbName; + $conn = new PDO( "sqlsrv:server = $server ; Database = $dbName ;", $uid, $pwd ); $query="IF OBJECT_ID('$tableName1', 'U') IS NOT NULL DROP TABLE $tableName1"; @@ -76,7 +78,7 @@ function DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ) $stmt=$conn->query( $query ); } -DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ); +DropTables( $server, $uid, $pwd, $tableName1, $tableName2 ); GenerateTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ); ?> diff --git a/test/functional/pdo_sqlsrv/skipif_azure.inc b/test/functional/pdo_sqlsrv/skipif_azure.inc index 38de106d..aec21ea5 100644 --- a/test/functional/pdo_sqlsrv/skipif_azure.inc +++ b/test/functional/pdo_sqlsrv/skipif_azure.inc @@ -2,9 +2,7 @@ if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv')) die("PDO driver cannot be loaded; skipping test.\n"); -include 'MsCommon.inc'; -if ( IsDaasMode() ) { - die("test not applicable in Azure"); -} - +require 'MsSetup.inc'; +if ($daasMode) die("skip test not applicable in Azure\n"); + ?> diff --git a/test/functional/sqlsrv/break.php b/test/functional/sqlsrv/break.php index 671dc48e..97abcccf 100644 --- a/test/functional/sqlsrv/break.php +++ b/test/functional/sqlsrv/break.php @@ -70,8 +70,10 @@ function BreakConnection( $conn, $conn_break ) } // Remove the tables generated by GenerateTables -function DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ) +function DropTables( $server, $uid, $pwd, $tableName1, $tableName2 ) { + global $dbName; + $connectionInfo = array( "Database"=>$dbName, "UID"=>$uid, "PWD"=>$pwd ); $conn = sqlsrv_connect( $server, $connectionInfo ); @@ -82,7 +84,7 @@ function DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ) $stmt=sqlsrv_query( $conn, $query ); } -DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ); +DropTables( $server, $uid, $pwd, $tableName1, $tableName2 ); GenerateTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 ); ?> diff --git a/test/functional/sqlsrv/skipif_azure.inc b/test/functional/sqlsrv/skipif_azure.inc index 1e6bdb6c..81c557a1 100644 --- a/test/functional/sqlsrv/skipif_azure.inc +++ b/test/functional/sqlsrv/skipif_azure.inc @@ -4,9 +4,7 @@ if (!extension_loaded("sqlsrv")) { die("skip extension not loaded"); } -include 'MsCommon.inc'; -if ( IsDaasMode() ) { - die("test not applicable in Azure"); -} +require 'MsSetup.inc'; +if ($daasMode) die("skip test not applicable in Azure\n"); ?> \ No newline at end of file From e7f00c1fed2438c7fa5b8fa466f87604e3511f40 Mon Sep 17 00:00:00 2001 From: yitam Date: Tue, 27 Jun 2017 15:03:04 -0700 Subject: [PATCH 05/12] modified the comments for the passwords tests --- test/functional/pdo_sqlsrv/pdo_passwords.phpt | 3 +-- test/functional/sqlsrv/test_non_alpha_password.phpt | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test/functional/pdo_sqlsrv/pdo_passwords.phpt b/test/functional/pdo_sqlsrv/pdo_passwords.phpt index 896935fb..959a12c1 100644 --- a/test/functional/pdo_sqlsrv/pdo_passwords.phpt +++ b/test/functional/pdo_sqlsrv/pdo_passwords.phpt @@ -3,8 +3,7 @@ Test password with non alphanumeric characters --DESCRIPTION-- The first three cases should have no problem connecting. Only the last case fails because the right curly brace should be escaped with another right brace. -In Azure we can't set DEFAULT_DATABASE for a login user. For this test to psss must connect -to the test database defined in MsSetup.inc +In Azure for this test to psss do not specify any particular database when connecting --SKIPIF-- --FILE-- diff --git a/test/functional/sqlsrv/test_non_alpha_password.phpt b/test/functional/sqlsrv/test_non_alpha_password.phpt index ed51cb4f..76b50e63 100644 --- a/test/functional/sqlsrv/test_non_alpha_password.phpt +++ b/test/functional/sqlsrv/test_non_alpha_password.phpt @@ -3,8 +3,7 @@ password with non alphanumeric characters --DESCRIPTION-- The first three cases should have no problem connecting. Only the last case fails because the right curly brace should be escaped with another right brace. -In Azure we can't set DEFAULT_DATABASE for a login user. For this test to psss must connect -to the test database defined in MsSetup.inc +In Azure for this test to psss do not specify any particular database when connecting --SKIPIF-- --FILE-- From 60575a552f456ba962cde1dbbd68b4c88eeab519 Mon Sep 17 00:00:00 2001 From: yitam Date: Tue, 27 Jun 2017 15:10:27 -0700 Subject: [PATCH 06/12] simplified skip conditions --- test/functional/sqlsrv/sqlsrv_testConnection.phpt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/functional/sqlsrv/sqlsrv_testConnection.phpt b/test/functional/sqlsrv/sqlsrv_testConnection.phpt index 7c9a672d..9d6da98c 100644 --- a/test/functional/sqlsrv/sqlsrv_testConnection.phpt +++ b/test/functional/sqlsrv/sqlsrv_testConnection.phpt @@ -2,11 +2,8 @@ variety of connection parameters. --SKIPIF-- --FILE-- Date: Tue, 27 Jun 2017 15:46:08 -0700 Subject: [PATCH 07/12] daasMode = false by default --- test/functional/pdo_sqlsrv/MsSetup.inc | 2 +- test/functional/sqlsrv/MsSetup.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/pdo_sqlsrv/MsSetup.inc b/test/functional/pdo_sqlsrv/MsSetup.inc index bcc290bc..96343778 100644 --- a/test/functional/pdo_sqlsrv/MsSetup.inc +++ b/test/functional/pdo_sqlsrv/MsSetup.inc @@ -35,7 +35,7 @@ $procName = 'php_test_proc'; $fileName = 'php_test_file.dat'; $dsn = "odbc:Driver={$DriverName};Server=$server"; $connectionOptions = array(); -$daasMode = 'DAASMODE'; +$daasMode = false; $marsMode = true; $dsnMode = true; $traceEnabled = false; diff --git a/test/functional/sqlsrv/MsSetup.inc b/test/functional/sqlsrv/MsSetup.inc index aa0078f7..2b0f02a8 100644 --- a/test/functional/sqlsrv/MsSetup.inc +++ b/test/functional/sqlsrv/MsSetup.inc @@ -20,7 +20,7 @@ $procName = "php_test_proc"; $fileName = "php_test_file.dat"; $connectionOptions = array("Database"=>$database, "UID"=>$userName, "PWD"=>$userPassword, "TraceOn"=>false); -$daasMode = 'DAASMODE'; +$daasMode = false; $marsMode = true; $traceEnabled = false; From 465a72352f81e75fa71aeda5b1655a3274ee995e Mon Sep 17 00:00:00 2001 From: yitam Date: Wed, 28 Jun 2017 09:48:33 -0700 Subject: [PATCH 08/12] modified the comments based on review --- test/functional/pdo_sqlsrv/pdo_passwords.phpt | 2 +- test/functional/sqlsrv/test_non_alpha_password.phpt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/functional/pdo_sqlsrv/pdo_passwords.phpt b/test/functional/pdo_sqlsrv/pdo_passwords.phpt index 959a12c1..cadcf9ae 100644 --- a/test/functional/pdo_sqlsrv/pdo_passwords.phpt +++ b/test/functional/pdo_sqlsrv/pdo_passwords.phpt @@ -3,7 +3,7 @@ Test password with non alphanumeric characters --DESCRIPTION-- The first three cases should have no problem connecting. Only the last case fails because the right curly brace should be escaped with another right brace. -In Azure for this test to psss do not specify any particular database when connecting +In Azure for this test to pass do not specify any particular database when connecting --SKIPIF-- --FILE-- diff --git a/test/functional/sqlsrv/test_non_alpha_password.phpt b/test/functional/sqlsrv/test_non_alpha_password.phpt index 76b50e63..319125ad 100644 --- a/test/functional/sqlsrv/test_non_alpha_password.phpt +++ b/test/functional/sqlsrv/test_non_alpha_password.phpt @@ -3,7 +3,7 @@ password with non alphanumeric characters --DESCRIPTION-- The first three cases should have no problem connecting. Only the last case fails because the right curly brace should be escaped with another right brace. -In Azure for this test to psss do not specify any particular database when connecting +In Azure for this test to pass do not specify any particular database when connecting --SKIPIF-- --FILE-- @@ -13,6 +13,7 @@ sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL ); function toConnect($options = array()) { + // this function makes a connection to the server without specifying the database require 'MsSetup.inc'; if (!isset($options['UID']) && !isset($options['uid'])) { From e93a40561a0bb35a96d01a1d48e92ce17d5ea1a1 Mon Sep 17 00:00:00 2001 From: yitam Date: Wed, 28 Jun 2017 09:59:55 -0700 Subject: [PATCH 09/12] fixed line number --- test/functional/sqlsrv/test_non_alpha_password.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/sqlsrv/test_non_alpha_password.phpt b/test/functional/sqlsrv/test_non_alpha_password.phpt index 319125ad..9133166b 100644 --- a/test/functional/sqlsrv/test_non_alpha_password.phpt +++ b/test/functional/sqlsrv/test_non_alpha_password.phpt @@ -62,5 +62,5 @@ print "Test successful"; ?> --EXPECTREGEX-- An unescaped right brace \(}\) was found in either the user name or password. All right braces must be escaped with another right brace \(}}\)\. -Warning: sqlsrv_close\(\) expects parameter 1 to be resource, boolean given in .+(\/|\\)test_non_alpha_password\.php on line 49 +Warning: sqlsrv_close\(\) expects parameter 1 to be resource, boolean given in .+(\/|\\)test_non_alpha_password\.php on line 50 Test successful From dcb232e7b9f7c5abe6dce67601082d1e97bf053a Mon Sep 17 00:00:00 2001 From: yitam Date: Wed, 28 Jun 2017 11:51:40 -0700 Subject: [PATCH 10/12] removed ConnectSpecial helper function --- test/functional/sqlsrv/MsCommon.inc | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/test/functional/sqlsrv/MsCommon.inc b/test/functional/sqlsrv/MsCommon.inc index ce6d83d4..e87e8018 100644 --- a/test/functional/sqlsrv/MsCommon.inc +++ b/test/functional/sqlsrv/MsCommon.inc @@ -159,22 +159,6 @@ function Connect($options = array()) return ($conn); } -function ConnectSpecial($options = array()) -{ - require 'MsSetup.inc'; - - if (!isset($options['UID']) && !isset($options['uid'])) { - $options['UID'] = $uid; - } - if (!isset($options['pwd']) && !isset($options['PWD'])) { - $options['pwd'] = $pwd; - } - if (!isset($options['Database'])) { - $options['Database'] = $database; - } - return sqlsrv_connect($server, $options); -} - function GetTempTableName($table = '', $temporary = true) { // A temporary table name with the '#' prefix will be automatically From 00aa8ad7c80a8ca1e8235929c0d5e1b608a56372 Mon Sep 17 00:00:00 2001 From: yitam Date: Wed, 28 Jun 2017 12:18:45 -0700 Subject: [PATCH 11/12] modified a comment --- test/functional/sqlsrv/test_non_alpha_password.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/sqlsrv/test_non_alpha_password.phpt b/test/functional/sqlsrv/test_non_alpha_password.phpt index 9133166b..b68d78ed 100644 --- a/test/functional/sqlsrv/test_non_alpha_password.phpt +++ b/test/functional/sqlsrv/test_non_alpha_password.phpt @@ -13,7 +13,7 @@ sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL ); function toConnect($options = array()) { - // this function makes a connection to the server without specifying the database + // this function makes a connection to the server WITHOUT specifying the database require 'MsSetup.inc'; if (!isset($options['UID']) && !isset($options['uid'])) { From f03b62e6b2ef2931e0997bf257b1cc1c56755cdd Mon Sep 17 00:00:00 2001 From: yitam Date: Wed, 28 Jun 2017 13:28:08 -0700 Subject: [PATCH 12/12] cleaned up toConnect helper method --- test/functional/sqlsrv/test_non_alpha_password.phpt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/test/functional/sqlsrv/test_non_alpha_password.phpt b/test/functional/sqlsrv/test_non_alpha_password.phpt index b68d78ed..ffd138c9 100644 --- a/test/functional/sqlsrv/test_non_alpha_password.phpt +++ b/test/functional/sqlsrv/test_non_alpha_password.phpt @@ -11,17 +11,12 @@ In Azure for this test to pass do not specify any particular database when conne sqlsrv_configure( 'WarningsReturnAsErrors', 0 ); sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL ); +require 'MsSetup.inc'; function toConnect($options = array()) { - // this function makes a connection to the server WITHOUT specifying the database - require 'MsSetup.inc'; + global $server; - if (!isset($options['UID']) && !isset($options['uid'])) { - $options['UID'] = $uid; - } - if (!isset($options['pwd']) && !isset($options['PWD'])) { - $options['pwd'] = $pwd; - } + // this function makes a connection to the server WITHOUT specifying the database return sqlsrv_connect($server, $options); } @@ -62,5 +57,5 @@ print "Test successful"; ?> --EXPECTREGEX-- An unescaped right brace \(}\) was found in either the user name or password. All right braces must be escaped with another right brace \(}}\)\. -Warning: sqlsrv_close\(\) expects parameter 1 to be resource, boolean given in .+(\/|\\)test_non_alpha_password\.php on line 50 +Warning: sqlsrv_close\(\) expects parameter 1 to be resource, boolean given in .+(\/|\\)test_non_alpha_password\.php on line 45 Test successful