mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Bring PDO_ODBC tests in sync with PDO base tests.
This commit is contained in:
parent
289997715a
commit
4187a6e3c7
@ -4,7 +4,7 @@ $USER = 'db2inst1';
|
||||
$PASSWD = 'ibmdb2';
|
||||
$DBNAME = 'SAMPLE';
|
||||
|
||||
$CONNECTION = "odbc:$DBNAME";
|
||||
$CONNECTION = "odbc:DSN=$DBNAME;UID=$USER;PWD=$PASSWD;";
|
||||
|
||||
$PDO_TESTS = dirname(__FILE__) . '/../../pdo/tests/';
|
||||
|
||||
|
119
ext/pdo_odbc/tests/pdo_016.phpt
Executable file
119
ext/pdo_odbc/tests/pdo_016.phpt
Executable file
@ -0,0 +1,119 @@
|
||||
--TEST--
|
||||
PDO_ODBC: PDO_FETCH_BOUND
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
require_once('prepare.inc');
|
||||
|
||||
$DB->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_016.inc');
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
===INIT===
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
string(1) "3"
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
}
|
||||
===WHILE===
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
}
|
||||
array(1) {
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
}
|
||||
array(1) {
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
}
|
||||
===ALONE===
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
}
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
}
|
||||
array(1) {
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
}
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
array(1) {
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
}
|
||||
array(1) {
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
}
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
array(1) {
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
}
|
||||
===REBIND/SAME===
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
}
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(7) "String0"
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(1) "0"
|
||||
array(1) {
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
}
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(7) "String1"
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(1) "1"
|
||||
array(1) {
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
}
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(7) "String2"
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(1) "2"
|
||||
===REBIND/CONFLICT===
|
||||
string(7) "String0"
|
||||
string(7) "String1"
|
||||
string(7) "String2"
|
||||
===DONE===
|
142
ext/pdo_odbc/tests/pdo_018.phpt
Executable file
142
ext/pdo_odbc/tests/pdo_018.phpt
Executable file
@ -0,0 +1,142 @@
|
||||
--TEST--
|
||||
PDO_ODBC: PDO Unserializing
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
require_once('skipif.inc');
|
||||
if (!interface_exists('Serializable')) die ('skip Interface Serializable does not exist');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
require_once('prepare.inc');
|
||||
|
||||
$SQL = array(
|
||||
'create1'=>'CREATE TABLE classtypes(id INT NOT NULL PRIMARY KEY, name VARCHAR(20) NOT NULL UNIQUE)',
|
||||
);
|
||||
|
||||
$DB->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_018.inc');
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
===INIT===
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
string(1) "3"
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(8) "stdClass"
|
||||
[1]=>
|
||||
string(8) "TestBase"
|
||||
[2]=>
|
||||
string(11) "TestDerived"
|
||||
}
|
||||
===TYPES===
|
||||
array(4) {
|
||||
["stdClass"]=>
|
||||
string(1) "0"
|
||||
["TestBase"]=>
|
||||
string(1) "1"
|
||||
["TestDerived"]=>
|
||||
string(1) "2"
|
||||
["TestLeaf"]=>
|
||||
NULL
|
||||
}
|
||||
===INSERT===
|
||||
TestBase::serialize() = 'a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}'
|
||||
TestDerived::serialize()
|
||||
TestBase::serialize() = 'a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}'
|
||||
TestDerived::serialize()
|
||||
TestBase::serialize() = 'a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}'
|
||||
===DATA===
|
||||
array(4) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
string(91) "a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}"
|
||||
[2]=>
|
||||
string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
|
||||
[3]=>
|
||||
string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
|
||||
}
|
||||
===FAILURE===
|
||||
Exception:SQLSTATE[HY000]: General error: cannot unserialize class
|
||||
===COUNT===
|
||||
string(1) "3"
|
||||
===DATABASE===
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
["NAME"]=>
|
||||
string(8) "TestBase"
|
||||
["VAL"]=>
|
||||
string(91) "a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}"
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
["NAME"]=>
|
||||
string(11) "TestDerived"
|
||||
["VAL"]=>
|
||||
string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
|
||||
}
|
||||
[2]=>
|
||||
array(2) {
|
||||
["NAME"]=>
|
||||
NULL
|
||||
["VAL"]=>
|
||||
string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
|
||||
}
|
||||
}
|
||||
===FETCHCLASS===
|
||||
TestBase::unserialize[22](a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";})
|
||||
TestDerived::unserialize()
|
||||
TestBase::unserialize[22](a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";})
|
||||
TestDerived::unserialize()
|
||||
TestBase::unserialize[22](a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";})
|
||||
array(3) {
|
||||
[0]=>
|
||||
object(TestBase)#%d (3) {
|
||||
["BasePub"]=>
|
||||
string(7) "#Public"
|
||||
["BasePro:protected"]=>
|
||||
string(10) "#Protected"
|
||||
["BasePri:private"]=>
|
||||
string(8) "#Private"
|
||||
}
|
||||
[1]=>
|
||||
object(TestDerived)#%d (6) {
|
||||
["BasePub"]=>
|
||||
string(14) "#DerivedPublic"
|
||||
["BasePro:protected"]=>
|
||||
string(17) "#DerivdeProtected"
|
||||
["DerivedPub"]=>
|
||||
string(7) "#Public"
|
||||
["DerivedPro:protected"]=>
|
||||
string(10) "#Protected"
|
||||
["DerivedPri:private"]=>
|
||||
string(7) "Private"
|
||||
["BasePri:private"]=>
|
||||
string(7) "Private"
|
||||
}
|
||||
[2]=>
|
||||
object(TestLeaf)#%d (6) {
|
||||
["BasePub"]=>
|
||||
string(14) "#DerivedPublic"
|
||||
["BasePro:protected"]=>
|
||||
string(17) "#DerivdeProtected"
|
||||
["DerivedPub"]=>
|
||||
string(7) "#Public"
|
||||
["DerivedPro:protected"]=>
|
||||
string(10) "#Protected"
|
||||
["DerivedPri:private"]=>
|
||||
string(7) "Private"
|
||||
["BasePri:private"]=>
|
||||
string(7) "Private"
|
||||
}
|
||||
}
|
||||
===DONE===
|
54
ext/pdo_odbc/tests/pdo_019.phpt
Executable file
54
ext/pdo_odbc/tests/pdo_019.phpt
Executable file
@ -0,0 +1,54 @@
|
||||
--TEST--
|
||||
PDO_ODBC: fetch() and while()
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
require_once('prepare.inc');
|
||||
|
||||
$DB->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_019.inc');
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
===INIT===
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
string(1) "4"
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
[3]=>
|
||||
string(7) "String3"
|
||||
}
|
||||
===WHILE===
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
}
|
||||
array(1) {
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
}
|
||||
array(1) {
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
}
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(7) "String3"
|
||||
}
|
||||
===DONE===
|
60
ext/pdo_odbc/tests/pdo_023.phpt
Executable file
60
ext/pdo_odbc/tests/pdo_023.phpt
Executable file
@ -0,0 +1,60 @@
|
||||
--TEST--
|
||||
PDO_ODBC: Overloading
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
require_once('prepare.inc');
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_023_def.inc');
|
||||
|
||||
$DB = NULL;
|
||||
|
||||
$DB = new PDODatabaseX($CONNECTION, $USER, $PASSWD);
|
||||
$DB->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_WARNING);
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_023.inc');
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
int(2)
|
||||
object(PDODatabaseX)#%d (2) {
|
||||
["test1"]=>
|
||||
int(1)
|
||||
["test2"]=>
|
||||
int(22)
|
||||
}
|
||||
PDODatabaseX::query()
|
||||
PDOStatementX::__construct()
|
||||
PDOStatementX::__destruct()
|
||||
PDODatabaseX::query()
|
||||
PDOStatementX::__construct()
|
||||
PDOStatementX::__destruct()
|
||||
PDODatabaseX::query()
|
||||
PDOStatementX::__construct()
|
||||
PDOStatementX::__destruct()
|
||||
PDODatabaseX::query()
|
||||
PDOStatementX::__construct()
|
||||
object(PDOStatementX)#%d (3) {
|
||||
["test1"]=>
|
||||
int(1)
|
||||
["queryString"]=>
|
||||
string(24) "SELECT val, id FROM test"
|
||||
["test2"]=>
|
||||
int(22)
|
||||
}
|
||||
array(2) {
|
||||
["A"]=>
|
||||
string(1) "0"
|
||||
["B"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
PDOStatementX::__destruct()
|
||||
PDODatabaseX::__destruct()
|
||||
===DONE===
|
25
ext/pdo_odbc/tests/pdo_024.phpt
Executable file
25
ext/pdo_odbc/tests/pdo_024.phpt
Executable file
@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
PDO_ODBC: Bind does not convert NULL
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
require_once('prepare.inc');
|
||||
|
||||
$SQL['create'] = 'CREATE TABLE test(id INT, val VARCHAR(10))';
|
||||
|
||||
$DB->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_024.inc');
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
bind: success
|
||||
bool(true)
|
||||
NULL
|
||||
===DONE===
|
70
ext/pdo_odbc/tests/pdo_025.phpt
Executable file
70
ext/pdo_odbc/tests/pdo_025.phpt
Executable file
@ -0,0 +1,70 @@
|
||||
--TEST--
|
||||
PDO_ODBC: PDO_FETCH_INTO
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
require_once('prepare.inc');
|
||||
|
||||
$DB->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_025.inc');
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
object(Test)#%d (3) {
|
||||
["id"]=>
|
||||
string(2) "10"
|
||||
["val"]=>
|
||||
string(3) "Abc"
|
||||
["val2"]=>
|
||||
string(3) "zxy"
|
||||
}
|
||||
object(Test)#%d (3) {
|
||||
["id"]=>
|
||||
string(2) "20"
|
||||
["val"]=>
|
||||
string(3) "Def"
|
||||
["val2"]=>
|
||||
string(3) "wvu"
|
||||
}
|
||||
object(Test)#%d (3) {
|
||||
["id"]=>
|
||||
string(2) "30"
|
||||
["val"]=>
|
||||
string(3) "Ghi"
|
||||
["val2"]=>
|
||||
string(3) "tsr"
|
||||
}
|
||||
object(Test)#%d (3) {
|
||||
["id"]=>
|
||||
string(2) "40"
|
||||
["val"]=>
|
||||
string(3) "Jkl"
|
||||
["val2"]=>
|
||||
string(3) "qpo"
|
||||
}
|
||||
object(Test)#%d (3) {
|
||||
["id"]=>
|
||||
string(2) "50"
|
||||
["val"]=>
|
||||
string(3) "Mno"
|
||||
["val2"]=>
|
||||
string(3) "nml"
|
||||
}
|
||||
object(Test)#%d (3) {
|
||||
["id"]=>
|
||||
string(2) "60"
|
||||
["val"]=>
|
||||
string(3) "Pqr"
|
||||
["val2"]=>
|
||||
string(3) "kji"
|
||||
}
|
||||
===FAIL===
|
||||
|
||||
Fatal error: Cannot access protected property Fail::$id in %spdo_025.inc on line %d
|
50
ext/pdo_odbc/tests/pdo_026.phpt
Executable file
50
ext/pdo_odbc/tests/pdo_026.phpt
Executable file
@ -0,0 +1,50 @@
|
||||
--TEST--
|
||||
PDO_ODBC: Deriving PDO
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
require_once('prepare.inc');
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_026.inc');
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECT--
|
||||
string(11) "PDODatabase"
|
||||
string(12) "PDOStatement"
|
||||
PDODatabase::query()
|
||||
PDOStatementX::__construct()
|
||||
string(13) "PDOStatementX"
|
||||
string(11) "PDODatabase"
|
||||
array(3) {
|
||||
["ID"]=>
|
||||
string(2) "10"
|
||||
["VAL"]=>
|
||||
string(3) "Abc"
|
||||
["VAL2"]=>
|
||||
string(3) "zxy"
|
||||
}
|
||||
array(3) {
|
||||
["ID"]=>
|
||||
string(2) "20"
|
||||
["VAL"]=>
|
||||
string(3) "Def"
|
||||
["VAL2"]=>
|
||||
string(3) "wvu"
|
||||
}
|
||||
array(3) {
|
||||
["ID"]=>
|
||||
string(2) "30"
|
||||
["VAL"]=>
|
||||
string(3) "Ghi"
|
||||
["VAL2"]=>
|
||||
string(3) "tsr"
|
||||
}
|
||||
===DONE===
|
||||
PDODatabase::__destruct()
|
||||
PDOStatementX::__destruct()
|
@ -6,7 +6,8 @@ $SQL = array(
|
||||
'create'=>'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'
|
||||
);
|
||||
|
||||
$DB = new pdo($CONNECTION, $USER, $PASSWD);
|
||||
//$DB = new pdo($CONNECTION, $USER, $PASSWD);
|
||||
$DB = new pdo($CONNECTION);
|
||||
|
||||
foreach(array('test','classtypes') as $name)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user