php-src/pear/tests/pear1.phpt
Stig Bakken 971f8b0881 @Added a more configurable error reporting interface to DB.
Added a more configurable error reporting interface to DB.
Also added some more tests, and moved the DB tests to pear/DB/tests.
#Usage example that prints and exits on every error:
#$dbh = DB::connect($dsn);
#$dbh->setErrorHandling(PEAR_ERROR_DIE);
#
#Example with plain callback function:
#$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, "errorHandler");
#
#Example with object callback function:
#$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, array($obj, "errorHandler"));
#
#Handler functions/methods are called with the error object as a parameter.
#
2000-09-09 02:39:56 +00:00

40 lines
800 B
PHP

--TEST--
PEAR constructor/destructor test
--SKIPIF--
--FILE--
<?php
require_once "PEAR.php";
class TestPEAR extends PEAR {
function TestPEAR($name) {
$this->_debug = true;
$this->name = $name;
$this->PEAR();
}
function _TestPEAR() {
print "This is the TestPEAR($this->name) destructor\n";
$this->_PEAR();
}
}
print "test class TestPEAR\n";
$o = new TestPEAR("test1");
$p = new TestPEAR("test2");
var_dump(get_class($o));
var_dump(get_class($p));
?>
--GET--
--POST--
--EXPECT--
test class TestPEAR
PEAR constructor called, class=testpear
PEAR constructor called, class=testpear
string(8) "testpear"
string(8) "testpear"
This is the TestPEAR(test1) destructor
PEAR destructor called, class=testpear
This is the TestPEAR(test2) destructor
PEAR destructor called, class=testpear