Skip to content

Commit

Permalink
Added or modified comments as per review
Browse files Browse the repository at this point in the history
  • Loading branch information
yitam committed Oct 23, 2019
1 parent 2163f99 commit 03fed92
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
GitHub issue 1018 - Test PDO::prepare() with the extended string types
GitHub issue 1018 - Test emulate prepared statements with the extended string types
--DESCRIPTION--
This test verifies the extended string types, PDO::ATTR_DEFAULT_STR_PARAM, PDO::PARAM_STR_NATL and
PDO::PARAM_STR_CHAR will affect "emulate prepared" statements. If the parameter encoding is specified,
Expand Down Expand Up @@ -75,7 +75,7 @@ try {
$testCase = 'Test case 7: no extended string types (uses the default)';
toEmulatePrepare($conn, PDO::PARAM_STR, $p1, $testCase);

// Test case 8: uses the default PDO::PARAM_STR_CHAR without specifying
// Test case 8: uses the default PDO::PARAM_STR_CHAR without specifying but specifies UTF 8 encoding
$testCase = 'Test case 8: no extended string types (uses the default) but with UTF-8 ';
toEmulatePrepare($conn, PDO::PARAM_STR, $p, $testCase, true);

Expand All @@ -95,7 +95,7 @@ try {
$testCase = 'Test case 11: no extended string types (uses the default)';
toEmulatePrepare($conn, PDO::PARAM_STR, $p, $testCase);

// Test case 12: uses the default PDO::PARAM_STR_NATL without specifying
// Test case 12: uses the default PDO::PARAM_STR_NATL without specifying but specifies UTF 8 encoding
$testCase = 'Test case 12: no extended string types (uses the default) but with UTF-8';
toEmulatePrepare($conn, PDO::PARAM_STR, $p, $testCase, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function testErrorCase2($conn, $isChar)
$error = '*An invalid attribute was designated on the PDOStatement object.';
$pdoParam = ($isChar) ? PDO::PARAM_STR_CHAR : PDO::PARAM_STR_NATL;

// This will cause an exception because PDO::ATTR_DEFAULT_STR_PARAM is not a statement attribute
$stmt->setAttribute(PDO::ATTR_DEFAULT_STR_PARAM, $pdoParam);
} catch (PDOException $e) {
if (!fnmatch($error, $e->getMessage())) {
Expand All @@ -33,6 +34,8 @@ function testErrorCase($attr)
try {
$conn = connect();
$error = '*Invalid extended string type specified. PDO_ATTR_DEFAULT_STR_PARAM can be either PDO_PARAM_STR_CHAR or PDO_PARAM_STR_NATL.';

// This will cause an exception because PDO::ATTR_DEFAULT_STR_PARAM expects either PDO_PARAM_STR_CHAR or PDO_PARAM_STR_NATL only
$conn->setAttribute(PDO::ATTR_DEFAULT_STR_PARAM, $attr);
} catch (PDOException $e) {
if (!fnmatch($error, $e->getMessage())) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
GitHub issue 1018 - Test PDO::prepare() with the extended string types
GitHub issue 1018 - Test real prepared statements with the extended string types
--DESCRIPTION--
This test verifies the extended string types, PDO::ATTR_DEFAULT_STR_PARAM, PDO::PARAM_STR_NATL and
PDO::PARAM_STR_CHAR will NOT affect real prepared statements. Unlike emulate prepared statements,
Expand Down

0 comments on commit 03fed92

Please sign in to comment.