Example #1
0
 /**
  * Create an exception.
  * An exception is built with a formatted message, a code (an ID), and an
  * array that contains the list of formatted string for the message. If
  * chaining, we can add a previous exception.
  *
  * @param   string      $message      Formatted message.
  * @param   int         $code         Code (the ID).
  * @param   array       $arguments    Arguments to format message.
  * @param   \Throwable  $previous     Previous exception in chaining.
  * @return  void
  */
 public function __construct($message, $code = 0, $arguments = [], $previous = null)
 {
     parent::__construct($message, $code, $arguments, $previous);
     if (false === Event::eventExists('hoa://Event/Exception')) {
         Event::register('hoa://Event/Exception', __CLASS__);
     }
     $this->send();
     return;
 }
Example #2
0
 public function case_event_is_registered()
 {
     $this->given(new SUT('foo'))->when($result = Event::eventExists('hoa://Event/Exception'))->then->boolean($result)->isTrue();
 }