From 292811ffee7edc21c7e4c4b07598fcf268904c39 Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Wed, 13 Dec 2017 12:51:22 -0800 Subject: [PATCH] Applied changes as per review --- test/functional/sqlsrv/sqlsrv_prepare.phpt | 17 +++++++++++------ test/functional/sqlsrv/sqlsrv_query.phpt | 12 +++++++----- .../sqlsrv/sqlsrv_send_stream_data.phpt | 16 +++++++++------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/test/functional/sqlsrv/sqlsrv_prepare.phpt b/test/functional/sqlsrv/sqlsrv_prepare.phpt index 6bc742d1..8f504303 100644 --- a/test/functional/sqlsrv/sqlsrv_prepare.phpt +++ b/test/functional/sqlsrv/sqlsrv_prepare.phpt @@ -68,6 +68,9 @@ binding parameters, including output parameters, using the simplified syntax. die("sqlsrv_execute failed."); } + $textValues = array("This is some text meant to test binding parameters to streams", + "This is some more text meant to test binding parameters to streams"); + $k = 0; while (sqlsrv_fetch($stmt)) { $id = sqlsrv_get_field($stmt, 0, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR)); echo "$id\n"; @@ -85,7 +88,9 @@ binding parameters, including output parameters, using the simplified syntax. } else { while (!feof($stream)) { $str = fread($stream, 10000); - echo $str; + if ($str !== $textValues[$k++]) { + fatalError("Incorrect data: \'$str\'!\n"); + } } } echo "\n"; @@ -129,14 +134,14 @@ binding parameters, including output parameters, using the simplified syntax. sqlsrv_free_stmt($stmt); sqlsrv_close($conn); ?> ---EXPECTREGEX-- +--EXPECT-- 1 -12\.0 +12.0 testtestte -(This is some text meant to test binding parameters to streams)? + 2 -13\.0 +13.0 testtestte -(This is some more text meant to test binding parameters to streams)? + 3 4 diff --git a/test/functional/sqlsrv/sqlsrv_query.phpt b/test/functional/sqlsrv/sqlsrv_query.phpt index 5e3b1ce5..e3fde92a 100644 --- a/test/functional/sqlsrv/sqlsrv_query.phpt +++ b/test/functional/sqlsrv/sqlsrv_query.phpt @@ -50,14 +50,16 @@ sqlsrv_query test. Performs same tasks as 0006.phpt, using sqlsrv_query. $stream = sqlsrv_get_field($stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY)); if (!$stream) { if (AE\isColEncrypted()) { - echo sqlsrv_errors()[0]['message']; + verifyError(sqlsrv_errors()[0], 'IMSSP', 'Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.'); } else { fatalError('Fetching data stream failed!'); } } else { while (!feof($stream)) { $str = fread($stream, 4000); - echo $str; + if ($str !== "This is some text meant to test binding parameters to streams") { + fatalError("Incorrect data: \'$str\'!\n"); + } } } echo "\n"; @@ -69,8 +71,8 @@ sqlsrv_query test. Performs same tasks as 0006.phpt, using sqlsrv_query. sqlsrv_close($conn); ?> ---EXPECTREGEX-- +--EXPECT-- 1 -12\.0 +12.0 testtestte -(This is some text meant to test binding parameters to streams|Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.) + diff --git a/test/functional/sqlsrv/sqlsrv_send_stream_data.phpt b/test/functional/sqlsrv/sqlsrv_send_stream_data.phpt index bb2cee6c..aa9ff82d 100644 --- a/test/functional/sqlsrv/sqlsrv_send_stream_data.phpt +++ b/test/functional/sqlsrv/sqlsrv_send_stream_data.phpt @@ -115,14 +115,16 @@ binding streams using full syntax. $stream = sqlsrv_get_field($stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY)); if (!$stream) { if (AE\isColEncrypted()) { - echo sqlsrv_errors()[0]['message']; + verifyError(sqlsrv_errors()[0], 'IMSSP', 'Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.'); } else { fatalError('Fetching data stream failed!'); } } else { while (!feof($stream)) { $str = fread($stream, 10000); - echo $str; + if ($str !== "This is some text meant to test binding parameters to streams") { + fatalError("Incorrect data: \'$str\'!\n"); + } } } echo "\n"; @@ -161,11 +163,11 @@ binding streams using full syntax. dropTable($conn, $tableName); sqlsrv_close($conn); ?> ---EXPECTREGEX-- -sqlsrv_query\(2\) failed\. -sqlsrv_query\(3\) failed\. +--EXPECT-- +sqlsrv_query(2) failed. +sqlsrv_query(3) failed. 1 -12\.0 +12.0 testtestte -(This is some text meant to test binding parameters to streams|Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.) + Done \ No newline at end of file