lithium\tests\cases\core\ErrorHandlerTest::testErrorCatching PHP Method

testErrorCatching() public method

public testErrorCatching ( )
    public function testErrorCatching()
    {
        $this->skipIf(true, 'Refactoring original error-handling iteration.');
        $self = $this;
        ErrorHandler::config(array(array('code' => E_WARNING | E_USER_WARNING, 'handler' => function ($info) use($self) {
            $self->errors[] = $info;
        })));
        file_get_contents(false);
        $this->assertCount(1, $this->errors);
        $result = end($this->errors);
        $this->assertPattern('/Filename cannot be empty/', $result['message']);
        trigger_error('Test warning', E_USER_WARNING);
        $this->assertCount(2, $this->errors);
        $result = end($this->errors);
        $this->assertEqual('Test warning', $result['message']);
        trigger_error('Test notice', E_USER_NOTICE);
        $this->assertCount(2, $this->errors);
    }