diff --git a/test/pdo_sqlsrv/pdo_construct_attr.phpt b/test/pdo_sqlsrv/pdo_construct_attr.phpt index 4b248412..0cde5aad 100644 --- a/test/pdo_sqlsrv/pdo_construct_attr.phpt +++ b/test/pdo_sqlsrv/pdo_construct_attr.phpt @@ -1,5 +1,5 @@ --TEST-- -Test PDO::__Construct by passing connection options +Test PDO::__Construct by passing different connection attributes --SKIPIF-- --FILE-- @@ -18,7 +18,7 @@ try PDO::SQLSRV_ATTR_DIRECT_QUERY => true, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::SQLSRV_ATTR_CLIENT_BUFFER_MAX_KB_SIZE => -1, + PDO::SQLSRV_ATTR_CLIENT_BUFFER_MAX_KB_SIZE => 10240, PDO::SQLSRV_ATTR_DIRECT_QUERY => true ); @@ -30,6 +30,9 @@ try $stmt = $conn->prepare("SELECT 1"); $stmt->execute(); + // fetch result, which should be stringified since ATTR_STRINGIFY_FETCHES is on + var_dump(($stmt->fetch(PDO::FETCH_ASSOC))); + $stmt = NULL; $conn = NULL; @@ -44,4 +47,8 @@ catch( PDOException $e ) { --EXPECT-- +array(1) { + [""]=> + string(1) "1" +} Test Successful \ No newline at end of file diff --git a/test/pdo_sqlsrv/pdo_construct_dsn_format_incorrect.phpt b/test/pdo_sqlsrv/pdo_construct_dsn_error.phpt similarity index 87% rename from test/pdo_sqlsrv/pdo_construct_dsn_format_incorrect.phpt rename to test/pdo_sqlsrv/pdo_construct_dsn_error.phpt index 38c94da0..4e44a26f 100644 --- a/test/pdo_sqlsrv/pdo_construct_dsn_format_incorrect.phpt +++ b/test/pdo_sqlsrv/pdo_construct_dsn_error.phpt @@ -1,5 +1,5 @@ --TEST-- -Test PDO::__Construct without specifying the Server +Test PDO::__Construct with incorrectly formatted DSN or no Server specified in DSN --SKIPIF-- --FILE-- @@ -9,7 +9,6 @@ require_once("autonomous_setup.php"); /*----------Connection option cases that raises errors----------*/ //dsn with 2 consecutive semicolons - try { $conn = new PDO( "sqlsrv:Server = $serverName;;", $username, $password ); @@ -69,6 +68,16 @@ catch( PDOException $e ) { print_r( ($e->errorInfo)[2] ); echo "\n"; } +// Try to connect with no server specified +try +{ + $database = "tempdb"; + @$conn = new PDO( "sqlsrv:Database = $database", $username, $password ); +} +catch( PDOException $e ) { + print_r( ($e->errorInfo)[2] ); + echo "\n"; +} echo "\n"; /*----------Connection option cases that is OK----------*/ @@ -106,6 +115,7 @@ An expected right brace \(\}\) was not found in the DSN string for the value of An invalid value was specified for the keyword 'Database' in the DSN string\. The DSN string ended unexpectedly\. An invalid DSN string was specified\. +Server keyword was not specified in the DSN string\. value in curly braces OK value in curly braces followed by a semicolon OK diff --git a/test/pdo_sqlsrv/pdo_construct_no_server.phpt b/test/pdo_sqlsrv/pdo_construct_no_server.phpt deleted file mode 100644 index 56bca4d3..00000000 --- a/test/pdo_sqlsrv/pdo_construct_no_server.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test PDO::__Construct without specifying the Server ---SKIPIF-- - ---FILE-- -errorInfo)[2] ); -} -?> - ---EXPECT-- - -Server keyword was not specified in the DSN string. \ No newline at end of file