1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-11-30 04:19:49 +01:00
ext-pq/tests/exceptions001.phpt
Michael Wallner 3024b0b5a9 tests & fixes
2013-02-14 14:54:22 +01:00

52 lines
1.0 KiB
PHP

--TEST--
exceptions
--SKIPIF--
<?php include "_skipif.inc"; ?>
--FILE--
<?php
echo "Test\n";
include "_setup.inc";
try {
new pq\Connection(1,2,3,4);
foo();
} catch (pq\Exception $e) {
assert($e->getCode() == pq\Exception::INVALID_ARGUMENT, $e->getCode()."!=".pq\Exception::INVALID_ARGUMENT);
}
try {
new pq\Connection(1,2,3,4);
foo();
} catch (pq\Exception\InvalidArgumentException $e) {
assert($e->getCode() == pq\Exception::INVALID_ARGUMENT, $e->getCode()."!=".pq\Exception::INVALID_ARGUMENT);
}
class c extends pq\Connection {
function __construct() {
}
function open($dsn) {
parent::__construct($dsn);
}
}
$c = new c;
try {
$c->reset();
foo();
} catch (pq\Exception\BadMethodCallException $e) {
assert($e->getCode() == pq\Exception::UNINITIALIZED, $e->getCode()."!=".pq\Exception::UNINITIALIZED);
}
$c->open(PQ_DSN);
try {
$c->open(PQ_DSN);
foo();
} catch (pq\Exception\BadMethodCallException $e) {
assert($e->getCode() == pq\Exception::BAD_METHODCALL, $e->getCode()."!=".pq\Exception::BAD_METHODCALL);
}
?>
DONE
--EXPECT--
Test
DONE