- Update test

This commit is contained in:
Marcus Boerger 2005-02-20 13:37:04 +00:00
parent 07a8ea220f
commit 44ab1ef86c

View file

@ -8,15 +8,16 @@ if (!extension_loaded("pdo_sqlite")) print "skip"; ?>
$db =new pdo('sqlite::memory:');
$db->exec('CREATE TABLE test(id int PRIMARY KEY, val VARCHAR(10))');
$db->exec('INSERT INTO test VALUES(1, "A")');
$db->exec('INSERT INTO test VALUES(2, "B")');
$db->exec('INSERT INTO test VALUES(3, "C")');
$db->exec('CREATE TABLE test(id int PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(10))');
$db->exec('INSERT INTO test VALUES(1, "A", "AA")');
$db->exec('INSERT INTO test VALUES(2, "B", "BB")');
$db->exec('INSERT INTO test VALUES(3, "C", "CC")');
class TestBase
{
public $id;
public $val;
protected $val;
private $val2;
}
class TestDerived extends TestBase
@ -40,83 +41,107 @@ var_dump($db->query('SELECT * FROM test')->fetchAll(PDO_FETCH_CLASS, 'TestDerive
--EXPECTF--
array(3) {
[0]=>
object(stdClass)#%d (2) {
object(stdClass)#%d (3) {
["id"]=>
string(1) "1"
["val"]=>
string(1) "A"
["val2"]=>
string(2) "AA"
}
[1]=>
object(stdClass)#%d (2) {
object(stdClass)#%d (3) {
["id"]=>
string(1) "2"
["val"]=>
string(1) "B"
["val2"]=>
string(2) "BB"
}
[2]=>
object(stdClass)#%d (2) {
object(stdClass)#%d (3) {
["id"]=>
string(1) "3"
["val"]=>
string(1) "C"
["val2"]=>
string(2) "CC"
}
}
array(3) {
[0]=>
object(TestBase)#%d (2) {
object(TestBase)#%d (3) {
["id"]=>
string(1) "1"
["val"]=>
["val:protected"]=>
string(1) "A"
["val2:private"]=>
string(2) "AA"
}
[1]=>
object(TestBase)#%d (2) {
object(TestBase)#%d (3) {
["id"]=>
string(1) "2"
["val"]=>
["val:protected"]=>
string(1) "B"
["val2:private"]=>
string(2) "BB"
}
[2]=>
object(TestBase)#%d (2) {
object(TestBase)#%d (3) {
["id"]=>
string(1) "3"
["val"]=>
["val:protected"]=>
string(1) "C"
["val2:private"]=>
string(2) "CC"
}
}
array(3) {
[0]=>
object(TestDerived)#%d (4) {
object(TestDerived)#%d (6) {
["p1:protected"]=>
int(1)
["p2:protected"]=>
int(2)
["id"]=>
string(1) "1"
["val"]=>
["val:protected"]=>
string(1) "A"
["val2:private"]=>
NULL
["val2"]=>
string(2) "AA"
}
[1]=>
object(TestDerived)#%d (4) {
object(TestDerived)#%d (6) {
["p1:protected"]=>
int(1)
["p2:protected"]=>
int(2)
["id"]=>
string(1) "2"
["val"]=>
["val:protected"]=>
string(1) "B"
["val2:private"]=>
NULL
["val2"]=>
string(2) "BB"
}
[2]=>
object(TestDerived)#%d (4) {
object(TestDerived)#%d (6) {
["p1:protected"]=>
int(1)
["p2:protected"]=>
int(2)
["id"]=>
string(1) "3"
["val"]=>
["val:protected"]=>
string(1) "C"
["val2:private"]=>
NULL
["val2"]=>
string(2) "CC"
}
}
===DONE===