config() 공개 정적인 메소드

Configure the ErrorHandler.
public static config ( array $config = [] ) : Current
$config array Configuration directives.
리턴 Current configuration set.
예제 #1
0
 public function testErrorCatching()
 {
     $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->assertEqual(1, count($this->errors));
     $result = end($this->errors);
     $this->assertPattern('/Filename cannot be empty/', $result['message']);
     trigger_error('Test warning', E_USER_WARNING);
     $this->assertEqual(2, count($this->errors));
     $result = end($this->errors);
     $this->assertEqual('Test warning', $result['message']);
     trigger_error('Test notice', E_USER_NOTICE);
     $this->assertEqual(2, count($this->errors));
 }
 public function testErrorTrapping()
 {
     ErrorHandler::stop();
     $self = $this;
     ErrorHandler::config(array(array('handler' => function ($info) use($self) {
         $self->errors[] = $info;
     })));
     ErrorHandler::run(array('trapErrors' => true));
     $this->assertEqual(0, count($this->errors));
     list($foo, $bar) = array('baz');
     $this->assertEqual(1, count($this->errors));
 }