diff --git a/test/functional/pdo_sqlsrv/break_pdo.php b/test/functional/pdo_sqlsrv/break_pdo.php index f892ab60..0be99e6f 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 ); } 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 @@ --FILE-- @@ -14,7 +13,7 @@ require 'MsSetup.inc'; try{ // Test 1 - $conn = new PDO( "sqlsrv:Server=$server;Database=$databaseName;ConnectionPooling=false;" , "test_password", "! ;4triou"); + $conn = new PDO( "sqlsrv:Server=$server;ConnectionPooling=false;" , "test_password", "! ;4triou"); if(!$conn) { echo "Test 1: Should have connected."; @@ -26,7 +25,7 @@ catch(PDOException $e){ } try{ // Test 2 - $conn = new PDO( "sqlsrv:Server=$server;Database=$databaseName;ConnectionPooling=false;" , "test_password2", "!}} ;4triou"); + $conn = new PDO( "sqlsrv:Server=$server;ConnectionPooling=false;" , "test_password2", "!}} ;4triou"); if(!$conn) { echo "Test 2: Should have connected."; @@ -38,7 +37,7 @@ catch(PDOException $e){ } try{ // Test 3 - $conn = new PDO( "sqlsrv:Server=$server;Database=$databaseName;ConnectionPooling=false;" , "test_password3", "! ;4triou}}"); + $conn = new PDO( "sqlsrv:Server=$server;ConnectionPooling=false;" , "test_password3", "! ;4triou}}"); if(!$conn) { echo "Test 3: Should have connected."; @@ -52,7 +51,7 @@ catch(PDOException $e){ try { // Test 4 - $conn = new PDO( "sqlsrv:Server=$server;Database=$databaseName;ConnectionPooling=false;" , "test_password3", "! ;4triou}"); + $conn = new PDO( "sqlsrv:Server=$server;ConnectionPooling=false;" , "test_password3", "! ;4triou}"); } catch( PDOException $e ) { print_r( $e->getMessage() ); diff --git a/test/functional/pdo_sqlsrv/skipif_azure.inc b/test/functional/pdo_sqlsrv/skipif_azure.inc index f91bd45b..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("skip test in Azure"); -} - +require 'MsSetup.inc'; +if ($daasMode) die("skip test not applicable in Azure\n"); + ?> 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 diff --git a/test/functional/sqlsrv/break.php b/test/functional/sqlsrv/break.php index 26e6a8fc..97abcccf 100644 --- a/test/functional/sqlsrv/break.php +++ b/test/functional/sqlsrv/break.php @@ -1,9 +1,9 @@ $uid, "PWD"=>$pwd ); + global $dbName; + + $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 ); } diff --git a/test/functional/sqlsrv/skipif_azure.inc b/test/functional/sqlsrv/skipif_azure.inc index c0450a67..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("skip test in Azure"); -} +require 'MsSetup.inc'; +if ($daasMode) die("skip test not applicable in Azure\n"); ?> \ No newline at end of file diff --git a/test/functional/sqlsrv/sqlsrv_testConnection.phpt b/test/functional/sqlsrv/sqlsrv_testConnection.phpt index 6e54786e..9d6da98c 100644 --- a/test/functional/sqlsrv/sqlsrv_testConnection.phpt +++ b/test/functional/sqlsrv/sqlsrv_testConnection.phpt @@ -1,7 +1,10 @@ --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..ffd138c9 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 pass do not specify any particular database when connecting --SKIPIF-- --FILE-- @@ -12,9 +11,16 @@ to the test database defined in MsSetup.inc sqlsrv_configure( 'WarningsReturnAsErrors', 0 ); sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL ); -require( 'MsCommon.inc' ); +require 'MsSetup.inc'; +function toConnect($options = array()) +{ + global $server; + + // this function makes a connection to the server WITHOUT specifying the database + 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 +28,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 +36,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 +44,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 +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 38 +Warning: sqlsrv_close\(\) expects parameter 1 to be resource, boolean given in .+(\/|\\)test_non_alpha_password\.php on line 45 Test successful