Ejemplo n.º 1
0
 public function testHandleException()
 {
     $exception = new Exception('test', 1);
     $this->errorHandler->handleException($exception, '2');
     $data = $this->storage->getData();
     $this->assertEquals(1, count($data), 'The stored data count is not 1');
     $this->assertTrue(isset($data['2']), 'No stored data');
     $this->errorHandler->handleException($exception, '2');
     $this->assertEquals(1, count($data), 'The stored data count is not 1');
 }
Ejemplo n.º 2
0
 public function testHandleException()
 {
     $exception = new Exception('test', 1);
     $this->errorHandler->handleException($exception, '2');
     $this->assertEquals(1, count($this->logger->loggedMessages), 'The logged messages count is not 1');
     $fields = $this->logger->loggedMessages[0]->getFields();
     $this->assertSame(ErrorHandlerHelper::E_EXCEPTION_DESCRIPTION, $fields['type'], 'The log message type does not match');
     $this->assertSame('2', $fields['error_id'], 'The log ID does not match');
     $this->assertSame(LOG_ERR, $this->logger->loggedMessages[0]->getPriority(), 'The log level does not match');
 }