mirror of
https://github.com/php/php-src.git
synced 2024-11-29 04:46:07 +08:00
971f8b0881
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. #
40 lines
800 B
PHP
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
|