]> granicus.if.org Git - php/commitdiff
- MFH: add new test
authorMarcus Boerger <helly@php.net>
Thu, 11 May 2006 22:17:42 +0000 (22:17 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 11 May 2006 22:17:42 +0000 (22:17 +0000)
ext/pdo/tests/bug_36428.phpt [new file with mode: 0755]

diff --git a/ext/pdo/tests/bug_36428.phpt b/ext/pdo/tests/bug_36428.phpt
new file mode 100755 (executable)
index 0000000..77dcdd0
--- /dev/null
@@ -0,0 +1,42 @@
+--TEST--
+PDO Common: PHP Bug #36428: Incorrect error message for PDO::fetchAll
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded('pdo')) die('skip');
+if (!extension_loaded('simplexml')) die('skip SimpleXML not loaded');
+$dir = getenv('REDIR_TEST_DIR');
+if (false == $dir) die('skip no driver');
+require_once $dir . 'pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); 
+require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
+
+$db = PDOTest::factory();
+$db->exec("CREATE TABLE test (a VARCHAR(10))");
+$db->exec("INSERT INTO test (a) VALUES ('xyz')");
+$res = $db->query("SELECT a FROM test");
+var_dump($res->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'SimpleXMLElement', array('<root/>')));
+
+?>
+===DONE===
+--EXPECTF--
+array(1) {
+  [0]=>
+  object(SimpleXMLElement)#%d (1) {
+    ["a"]=>
+    string(3) "xyz"
+  }
+}
+===DONE===
+--UEXPECTF--
+array(1) {
+  [0]=>
+  object(SimpleXMLElement)#3 (1) {
+    [u"a"]=>
+    unicode(3) "xyz"
+  }
+}
+===DONE===