Ejemplo n.º 1
0
 public function testIsIgnorablePath()
 {
     $this->configuration->setIgnorablePaths(['wp-admin', 'wp-login']);
     $service = new ErrorService($this->configuration);
     $_SERVER['REQUEST_URI'] = '/not-ignorable';
     $this->assertFalse($service->isIgnorablePath());
     $_SERVER['REQUEST_URI'] = '/wp-login';
     $this->assertTrue($service->isIgnorablePath());
 }
Ejemplo n.º 2
0
 protected function composeAndSendErrorMail()
 {
     $viewModel = new ViewModel(['error' => $this->getErrorReportMetaData()]);
     $viewModel->setTemplate('mail/errors');
     $renderer = new PhpRenderer();
     $renderer->setResolver(new TemplateMapResolver(['mail/errors' => __DIR__ . '/../../../../view/mail/errors.phtml']));
     $renderedView = $renderer->render($viewModel);
     $to = [];
     $cc = [];
     foreach ($this->configuration->getEmails() as $index => $mail) {
         if ($index == 0) {
             $to = ['email' => $mail, 'name' => ''];
         } else {
             $cc[] = ['email' => $mail, 'name' => ''];
         }
     }
     $params = ['to' => $to, 'cc' => $cc, 'from' => ['name' => '', 'email' => $this->configuration->getFromAddress()], 'subject' => $this->configuration->getSubject(), 'body' => $renderedView];
     $this->eventManager->trigger($this->event, null, $params);
 }