diff options
Diffstat (limited to 'ext/pdo_mysql/tests')
19 files changed, 115 insertions, 90 deletions
diff --git a/ext/pdo_mysql/tests/bug_41997.phpt b/ext/pdo_mysql/tests/bug_41997.phpt index c48a641f97..60bdfee2ba 100644 --- a/ext/pdo_mysql/tests/bug_41997.phpt +++ b/ext/pdo_mysql/tests/bug_41997.phpt @@ -46,13 +46,9 @@ array(1) { string(1) "1" } } -array(3) { +array(1) { [0]=> string(5) "00000" - [1]=> - NULL - [2]=> - NULL } array(1) { [0]=> @@ -61,12 +57,8 @@ array(1) { string(1) "2" } } -array(3) { +array(1) { [0]=> string(5) "00000" - [1]=> - NULL - [2]=> - NULL } -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/bug_43371.phpt b/ext/pdo_mysql/tests/bug_43371.phpt index 88c3a9bc6f..1890837aa9 100644 --- a/ext/pdo_mysql/tests/bug_43371.phpt +++ b/ext/pdo_mysql/tests/bug_43371.phpt @@ -2,6 +2,7 @@ Bug #43371 (Memory errors in PDO constructor) --SKIPIF-- <?php +<?php require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); MySQLPDOTest::skip(); diff --git a/ext/pdo_mysql/tests/mysql_pdo_test.inc b/ext/pdo_mysql/tests/mysql_pdo_test.inc index aa98d1464a..bf5f49db56 100644 --- a/ext/pdo_mysql/tests/mysql_pdo_test.inc +++ b/ext/pdo_mysql/tests/mysql_pdo_test.inc @@ -155,7 +155,7 @@ class MySQLPDOTest extends PDOTest { phpinfo(); $tmp = ob_get_contents(); ob_end_clean(); - return (bool)preg_match('/Client API version.*mysqlnd/', $tmp); + return (true == stristr($tmp, 'PDO Driver for MySQL, mysql native driver version')); } } diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt index fb955ac2aa..6b13465416 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt @@ -35,16 +35,11 @@ error_reporting=E_ALL $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); print "done!\n"; -?> --EXPECTF-- string(58) "CREATE TABLE test_%s(id INT)" -array(3) { +array(1) { [0]=> string(5) "00000" - [1]=> - NULL - [2]=> - NULL } array(1) { [0]=> @@ -53,4 +48,4 @@ array(1) { string(1) "1" } } -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt index 30aecf4b54..209bf3d89d 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt @@ -195,7 +195,7 @@ array(2) { ["label"]=> string(1) "z" } -[026] Autocommit mode of the MySQL Server should be off, got '1', [0] 00000 +[026] Autocommit mode of the MySQL Server should be off, got '1', [0] 00000 [028] I'm confused, how can autocommit be on? Didn't I say I want to manually control transactions? string(5) "00000" -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt b/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt index b09c1a5860..cfecaf74c9 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt @@ -12,8 +12,6 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); 'MYSQL_ATTR_USE_BUFFERED_QUERY' => true, 'MYSQL_ATTR_LOCAL_INFILE' => true, 'MYSQL_ATTR_DIRECT_QUERY' => true, - 'MYSQL_ATTR_FOUND_ROWS' => true, - 'MYSQL_ATTR_IGNORE_SPACE' => true, ); if (!MySQLPDOTest::isPDOMySQLnd()) { @@ -21,7 +19,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); $expected['MYSQL_ATTR_INIT_COMMAND'] = true; $expected['MYSQL_ATTR_READ_DEFAULT_FILE'] = true; $expected['MYSQL_ATTR_READ_DEFAULT_GROUP'] = true; - $expected['MYSQL_ATTR_COMPRESS'] = true; + } /* @@ -77,4 +75,4 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); print "done!"; --EXPECT-- -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt index 99b2b846b5..8829dc448a 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt @@ -14,9 +14,13 @@ $db = MySQLPDOTest::factory(); MySQLPDOTest::createTestTable($db); function check_error($offset, &$obj, $expected = '00000') { + $info = $obj->errorInfo(); - $code = $info[0]; + if (count($info) != 3) + printf("[%03d] Info should have three fields, got %s\n", + $offset, var_export($info, true)); + $code = $info[0]; if (($code != $expected) && (($expected != '00000') && ($code != ''))) { printf("[%03d] Expecting error code '%s' got code '%s'\n", $offset, $expected, $code); @@ -29,8 +33,6 @@ $db = MySQLPDOTest::factory(); printf("[%03d] Driver-specific error message.not set\n", $offset); } - - } function pdo_mysql_errorinfo($db, $offset) { @@ -98,12 +100,74 @@ $db = MySQLPDOTest::factory(); $db->exec('DROP TABLE IF EXISTS test'); print "done!"; -?> --EXPECTF-- Emulated Prepared Statements... +[002] Info should have three fields, got array ( + 0 => '00000', +) +[003] Info should have three fields, got array ( + 0 => '00000', +) +[004] Info should have three fields, got array ( + 0 => '00000', +) +[005] Info should have three fields, got array ( + 0 => '00000', +) +[009] Info should have three fields, got array ( + 0 => '00000', +) +[010] Info should have three fields, got array ( + 0 => '00000', +) +[013] Info should have three fields, got array ( + 0 => '00000', +) +[014] Info should have three fields, got array ( + 0 => '00000', +) +[015] Info should have three fields, got array ( + 0 => 'IM001', +) [015] Driver-specific error code not set [015] Driver-specific error message.not set +[016] Info should have three fields, got array ( + 0 => 'IM001', +) [016] Driver-specific error code not set [016] Driver-specific error message.not set +[017] Info should have three fields, got array ( + 0 => '00000', +) +[018] Info should have three fields, got array ( + 0 => '00000', +) Native Prepared Statements... -done! +[022] Info should have three fields, got array ( + 0 => '00000', +) +[023] Info should have three fields, got array ( + 0 => '00000', +) +[024] Info should have three fields, got array ( + 0 => '00000', +) +[025] Info should have three fields, got array ( + 0 => '00000', +) +[030] Info should have three fields, got array ( + 0 => '00000', +) +[033] Info should have three fields, got array ( + 0 => '00000', +) +[034] Info should have three fields, got array ( + 0 => '00000', +) +[037] Info should have three fields, got array ( + 0 => '00000', +) +[038] Info should have three fields, got array ( + 0 => '00000', +) +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt index 30e7bda479..8e978a279c 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt @@ -18,13 +18,17 @@ $db = MySQLPDOTest::factory(); ob_end_clean(); /* PDO Driver for MySQL, client library version => 6.0.3-alpha */ - $expected = sprintf('Client API version => %s', + $expected = sprintf('PDO Driver for MySQL, client library version => %s', $db->getAttribute(PDO::ATTR_CLIENT_VERSION)); if (false === stristr($tmp, $expected)) { - printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n"); + // maybe its PDO_MYSQLND + $expected = sprintf('PDO Driver for MySQL, mysql native driver version => %s', + $db->getAttribute(PDO::ATTR_CLIENT_VERSION)); + if (false === stristr($tmp, $expected)) + printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n"); } print "done!"; --EXPECT-- -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt index 30edcbe4b4..1f333b9a99 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt @@ -72,9 +72,7 @@ array(1) { now the same with native PS [005] Execute has failed, 'HY093' array ( 0 => 'HY093', - 1 => NULL, - 2 => NULL, ) array(0) { } -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt index a8faa8d13b..be83446c85 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt @@ -59,8 +59,6 @@ MySQLPDOTest::skip(); Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d [003] Execute has failed, 'HY093' array ( 0 => 'HY093', - 1 => NULL, - 2 => NULL, ) array(0) { } @@ -71,9 +69,7 @@ Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: num Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line 33 [005] Execute has failed, 'HY093' array ( 0 => 'HY093', - 1 => NULL, - 2 => NULL, ) array(0) { } -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt index 1d5f301608..87438011fb 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt @@ -114,7 +114,7 @@ $db = MySQLPDOTest::factory(); $row = $stmt->fetch(PDO::FETCH_ASSOC); if ($row !== $expected) { - printf("[004a] Expecting %s got %s\n", var_export($expected, true), var_export($row, true)); + printf("[004a] Expecting %s got %s\n", var_export($expected, true), vat_export($row, true)); } prepex(5, $db, 'DROP TABLE IF EXISTS test'); @@ -377,4 +377,4 @@ array(2) { string(10) "second row" } } -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt index 4f901964ec..a84c8d56d2 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt @@ -101,8 +101,6 @@ Native... Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d [003] Execute has failed, 'HY093' array ( 0 => 'HY093', - 1 => NULL, - 2 => NULL, ) array(0) { } @@ -132,9 +130,7 @@ Native... Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d [008] Execute has failed, 'HY093' array ( 0 => 'HY093', - 1 => NULL, - 2 => NULL, ) array(0) { } -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt index 4ead73d7fd..6f673c78b2 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt @@ -70,8 +70,6 @@ $db = MySQLPDOTest::factory(); --EXPECTF-- [003] Execute has failed, 'HY093' array ( 0 => 'HY093', - 1 => NULL, - 2 => NULL, ) array(0) { } @@ -84,4 +82,4 @@ array(1) { string(12) ":placeholder" } } -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt index da372534fd..c29ffff157 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt @@ -61,13 +61,9 @@ $db = MySQLPDOTest::factory(); ?> --EXPECTF-- Testing emulated PS... -array(3) { +array(1) { [0]=> string(0) "" - [1]=> - NULL - [2]=> - NULL } Warning: PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.ihopeitdoesnotexist' doesn't exist in %s on line %d @@ -90,25 +86,17 @@ array(3) { [2]=> string(%d) "Table '%s.test' doesn't exist" } -array(3) { +array(1) { [0]=> string(5) "00000" - [1]=> - NULL - [2]=> - NULL } Testing native PS... Warning: PDO::prepare(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.ihopeitdoesnotexist' doesn't exist in %s on line %d bool(false) -array(3) { +array(1) { [0]=> string(0) "" - [1]=> - NULL - [2]=> - NULL } Warning: PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.test' doesn't exist in %s on line %d @@ -128,4 +116,4 @@ array(3) { [2]=> string(%d) "Table '%s.ihopeitdoesnotexist' doesn't exist" } -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt index 5886a82c88..73ed5a2eab 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt @@ -130,11 +130,13 @@ object(myclass)#4 (1) { } Using PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE to fetch the object from DB and unserialize it... -myclass::unserialize('C:7:"myclass":19:{Data from serialize}') +myclass::__set(myobj, 'C:7:"myclass":19:{Data from serialize}') myclass::__construct(PDO shall not call __construct()) -object(myclass)#%d (1) { +object(myclass)#%d (2) { ["myprotected":protected]=> string(19) "a protected propery" + ["myobj"]=> + string(38) "C:7:"myclass":19:{Data from serialize}" } Using PDO::FETCH_CLASS to fetch the object from DB and unserialize it... @@ -146,4 +148,4 @@ object(myclass)#%d (2) { ["myobj"]=> string(38) "C:7:"myclass":19:{Data from serialize}" } -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt index ba29e6a53e..4233d911e9 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt @@ -89,8 +89,10 @@ object(myclass)#%d (0) { } And now PDO using setFetchMode(PDO::FETCH:CLASS|PDO::FETCH_SERIALIZE) + fetch()... -myclass::unserialize('Data fetched from DB to be given to unserialize()') +myclass::__set('myobj', 'Data fetched from DB to be given to unserialize()') myclass::__construct('Called by PDO') - note that it must not be called when unserializing -object(myclass)#%d (0) { +object(myclass)#%d (1) { + ["myobj"]=> + string(49) "Data fetched from DB to be given to unserialize()" } -done! +done!
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt index f88a1a385e..dbf60d527a 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt @@ -54,13 +54,9 @@ MySQLPDOTest::skip(); ?> --EXPECTF-- Emulated Prepared Statements... -array(3) { +array(1) { [0]=> string(5) "00000" - [1]=> - NULL - [2]=> - NULL } array(1) { [0]=> @@ -69,13 +65,9 @@ array(1) { string(1) "a" } } -array(3) { +array(1) { [0]=> string(5) "00000" - [1]=> - NULL - [2]=> - NULL } array(1) { [0]=> @@ -95,4 +87,4 @@ Native Prepared Statements... Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; SELECT label FROM test ORDER BY id ASC LIMIT 1' at line %d in %s on line %d -Fatal error: Call to a member function errorInfo() on a non-object in %s on line %d +Fatal error: Call to a member function errorInfo() on a non-object in %s on line %d
\ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt index fbe0e17965..90d4fb25ba 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt @@ -36,7 +36,7 @@ if (version_compare(PHP_VERSION, '5.0.0', '<')) } public function __call($method, $args) { - print "__call(".var_export($method,true).", ".var_export($args, true).")\n"; + print "__call()"; // $this->protocol(); } @@ -74,8 +74,10 @@ if (version_compare(PHP_VERSION, '5.0.0', '<')) $db->exec('DROP TABLE IF EXISTS test'); print "done!\n"; ?> +--XFAIL-- +PDO doesn't like __call() --EXPECTF-- -__construct('%S', '%S', '%S') +__construct('%s', '%s', '%s') exec('DROP TABLE IF EXISTS test') exec('CREATE TABLE test(id INT)') exec('INSERT INTO test(id) VALUES (1), (2)') diff --git a/ext/pdo_mysql/tests/pecl_bug_5780.phpt b/ext/pdo_mysql/tests/pecl_bug_5780.phpt index 5cc3497895..c2e0a79371 100644 --- a/ext/pdo_mysql/tests/pecl_bug_5780.phpt +++ b/ext/pdo_mysql/tests/pecl_bug_5780.phpt @@ -25,7 +25,6 @@ var_dump($authstmt->fetch(PDO::FETCH_NUM)); $info = $logstmt->errorInfo(); unset($info[2]); var_dump($info); -?> --EXPECT-- array(2) { [0]=> @@ -34,9 +33,7 @@ array(2) { string(7) "testing" } bool(true) -array(2) { +array(1) { [0]=> string(5) "00000" - [1]=> - NULL } |