3 class eh
extends http\
Object {
6 class ObjectTest
extends PHPUnit_Framework_TestCase
{
7 function testDefaultErrorHandling() {
8 $this->assertEquals(http\
Object::EH_NORMAL
, http\
Object::getDefaultErrorHandling());
9 http\
Object::setDefaultErrorHandling(http\
Object::EH_SUPPRESS
);
10 $this->assertEquals(http\
Object::EH_SUPPRESS
, http\
Object::getDefaultErrorHandling());
13 function testErrorHandling() {
15 $this->assertEquals(eh
::EH_NORMAL
, $eh->getErrorHandling());
16 $eh->setErrorHandling(eh
::EH_SUPPRESS
);
17 $this->assertEquals(eh
::EH_SUPPRESS
, $eh->getErrorHandling());
20 function testSuppress() {
21 http\
Object::setDefaultErrorHandling(http\
Object::EH_SUPPRESS
);
22 (new eh
)->triggerError(E_USER_WARNING
, http\Exception
::E_UNKNOWN
, "suppress");
25 function testException() {
26 http\
Object::setDefaultErrorHandling(http\
Object::EH_THROW
);
27 $this->setExpectedException("http\\Exception");
28 (new eh
)->triggerError(E_USER_WARNING
, http\Exception
::E_UNKNOWN
, "exception");
31 function testNormalError() {
32 http\
Object::setDefaultErrorHandling(http\
Object::EH_NORMAL
);
33 $this->setExpectedException("PHPUnit_Framework_Error_Warning");
34 (new eh
)->triggerError(E_USER_WARNING
, http\Exception
::E_UNKNOWN
, "warning");
37 function testSuppress2() {
39 $eh->setErrorHandling(http\
Object::EH_SUPPRESS
);
40 $eh->triggerError(E_USER_WARNING
, http\Exception
::E_UNKNOWN
, "suppress");
43 function testException2() {
45 $eh->setErrorHandling(http\
Object::EH_THROW
);
46 $this->setExpectedException("http\\Exception");
47 $eh->triggerError(E_USER_WARNING
, http\Exception
::E_UNKNOWN
, "exception");
50 function testNormalError2() {
52 $eh->setErrorHandling(http\
Object::EH_NORMAL
);
53 $this->setExpectedException("PHPUnit_Framework_Error_Warning");
54 $eh->triggerError(E_USER_WARNING
, http\Exception
::E_UNKNOWN
, "warning");
57 function testUnknownDefaultErrorHandling() {
58 $this->setExpectedException("PHPUnit_Framework_Error_Warning");
59 http\
Object::setDefaultErrorHandling(12345);
62 function testUnknownErrorHandling() {
64 $this->setExpectedException("PHPUnit_Framework_Error_Warning");
65 $eh->setErrorHandling(12345);