public function testEnvironmentPresentWhenRequested() { $_ENV["SOMETHING"] = "blah"; $this->config->sendEnvironment = true; $notification = new Bugsnag_Notification($this->config); $notification->addError($this->getError()); $notificationArray = $notification->toArray(); $this->assertEquals($notificationArray["events"][0]["metaData"]["Environment"]["SOMETHING"], "blah"); }
/** * Batches up errors into notifications for later sending * * @param Bugsnag_Error $error the error to batch up * @param array $metaData optional meta data to send with the error */ public function notify(Bugsnag_Error $error, $metaData = array()) { // Queue or send the error if ($this->sendErrorsOnShutdown()) { // Create a batch notification unless we already have one if (is_null($this->notification)) { $this->notification = new Bugsnag_Notification($this->config); } // Add this error to the notification $this->notification->addError($error, $metaData); } else { // Create and deliver notification immediately $notif = new Bugsnag_Notification($this->config); $notif->addError($error, $metaData); $notif->deliver(); } }