From: Marcus Boerger Date: Mon, 21 Feb 2005 18:55:51 +0000 (+0000) Subject: - Add new test X-Git-Tag: RELEASE_0_3~273 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab8f1f316b04b24d98830707ba3b192618004a18;p=php - Add new test --- diff --git a/ext/pdo/tests/pdo_010.inc b/ext/pdo/tests/pdo_010.inc new file mode 100755 index 0000000000..c25d935810 --- /dev/null +++ b/ext/pdo/tests/pdo_010.inc @@ -0,0 +1,53 @@ +exec($SQL['create1']); +$DB->exec($SQL['insert1']); +$DB->exec($SQL['insert2']); +$DB->exec($SQL['insert3']); +$DB->exec($SQL['create2']); +$DB->exec($SQL['insert4']); +$DB->exec($SQL['insert5']); +$DB->exec($SQL['insert6']); +$DB->exec($SQL['insert7']); + +class Test1 +{ + public function __construct() + { + echo __METHOD__ . "()\n"; + } +} + +class Test2 +{ + public function __construct() + { + echo __METHOD__ . "()\n"; + } +} + +class Test3 +{ + public function __construct() + { + echo __METHOD__ . "()\n"; + } +} + +var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_GROUP, 'Test3')); +var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_UNIQUE, 'Test3')); + +?> diff --git a/ext/pdo_mysql/tests/pdo_mysql_010.phpt b/ext/pdo_mysql/tests/pdo_mysql_010.phpt new file mode 100755 index 0000000000..03be77c991 --- /dev/null +++ b/ext/pdo_mysql/tests/pdo_mysql_010.phpt @@ -0,0 +1,76 @@ +--TEST-- +PDO-MySQL: PDO_FETCH_(CLASSTYPE and GROUP/UNIQUE) +--SKIPIF-- + +--FILE-- + +===DONE=== + +--EXPECTF-- +Test1::__construct() +Test2::__construct() +Test3::__construct() +array(2) { + ["Group1"]=> + array(2) { + [0]=> + object(stdClass)#%d (2) { + ["id"]=> + string(1) "1" + ["val"]=> + string(1) "A" + } + [1]=> + object(Test1)#%d (2) { + ["id"]=> + string(1) "2" + ["val"]=> + string(1) "B" + } + } + ["Group2"]=> + array(2) { + [0]=> + object(Test2)#%d (2) { + ["id"]=> + string(1) "3" + ["val"]=> + string(1) "C" + } + [1]=> + object(Test3)#%d (2) { + ["id"]=> + string(1) "4" + ["val"]=> + string(1) "D" + } + } +} +Test1::__construct() +Test2::__construct() +Test3::__construct() +array(2) { + ["Group1"]=> + object(Test1)#%d (2) { + ["id"]=> + string(1) "2" + ["val"]=> + string(1) "B" + } + ["Group2"]=> + object(Test3)#%d (2) { + ["id"]=> + string(1) "4" + ["val"]=> + string(1) "D" + } +} +===DONE=== diff --git a/ext/pdo_pgsql/tests/pdo_pgsql_010.phpt b/ext/pdo_pgsql/tests/pdo_pgsql_010.phpt new file mode 100755 index 0000000000..a52e135584 --- /dev/null +++ b/ext/pdo_pgsql/tests/pdo_pgsql_010.phpt @@ -0,0 +1,76 @@ +--TEST-- +PDO-PGSQL: PDO_FETCH_(CLASSTYPE and GROUP/UNIQUE) +--SKIPIF-- + +--FILE-- + +===DONE=== + +--EXPECTF-- +Test1::__construct() +Test2::__construct() +Test3::__construct() +array(2) { + ["Group1"]=> + array(2) { + [0]=> + object(stdClass)#%d (2) { + ["id"]=> + int(1) + ["val"]=> + string(1) "A" + } + [1]=> + object(Test1)#%d (2) { + ["id"]=> + int(2) + ["val"]=> + string(1) "B" + } + } + ["Group2"]=> + array(2) { + [0]=> + object(Test2)#%d (2) { + ["id"]=> + int(3) + ["val"]=> + string(1) "C" + } + [1]=> + object(Test3)#%d (2) { + ["id"]=> + int(4) + ["val"]=> + string(1) "D" + } + } +} +Test1::__construct() +Test2::__construct() +Test3::__construct() +array(2) { + ["Group1"]=> + object(Test1)#%d (2) { + ["id"]=> + int(2) + ["val"]=> + string(1) "B" + } + ["Group2"]=> + object(Test3)#%d (2) { + ["id"]=> + int(4) + ["val"]=> + string(1) "D" + } +} +===DONE=== diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_010.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_010.phpt new file mode 100755 index 0000000000..9872ad2fb9 --- /dev/null +++ b/ext/pdo_sqlite/tests/pdo_sqlite_010.phpt @@ -0,0 +1,76 @@ +--TEST-- +PDO-SQLite: PDO_FETCH_(CLASSTYPE and GROUP/UNIQUE) +--SKIPIF-- + +--FILE-- + +===DONE=== + +--EXPECTF-- +Test1::__construct() +Test2::__construct() +Test3::__construct() +array(2) { + ["Group1"]=> + array(2) { + [0]=> + object(stdClass)#%d (2) { + ["id"]=> + string(1) "1" + ["val"]=> + string(1) "A" + } + [1]=> + object(Test1)#%d (2) { + ["id"]=> + string(1) "2" + ["val"]=> + string(1) "B" + } + } + ["Group2"]=> + array(2) { + [0]=> + object(Test2)#%d (2) { + ["id"]=> + string(1) "3" + ["val"]=> + string(1) "C" + } + [1]=> + object(Test3)#%d (2) { + ["id"]=> + string(1) "4" + ["val"]=> + string(1) "D" + } + } +} +Test1::__construct() +Test2::__construct() +Test3::__construct() +array(2) { + ["Group1"]=> + object(Test1)#%d (2) { + ["id"]=> + string(1) "2" + ["val"]=> + string(1) "B" + } + ["Group2"]=> + object(Test3)#%d (2) { + ["id"]=> + string(1) "4" + ["val"]=> + string(1) "D" + } +} +===DONE===