/** * Constructor. * * @param RequestInterface $request * @param ResponseInterface $response * @param Logger $logger */ public function __construct(RequestInterface $request, ResponseInterface $response, Logger $logger = null) { $this->request = $request; $this->response = $response; $this->logger = is_null($logger) ? Services::logger(true) : $logger; $this->logger->info('Controller "' . get_class($this) . '" loaded.'); if ($this->forceHTTPS > 0) { $this->forceHTTPS($this->forceHTTPS); } $this->loadHelpers(); }
public function testDebugLogsCorrectly() { $config = new LoggerConfig(); $logger = new Logger($config); $expected = 'DEBUG - ' . date('Y-m-d') . ' --> Test message'; $logger->debug('Test message'); $logs = TestHandler::getLogs(); $this->assertEquals(1, count($logs)); $this->assertEquals($expected, $logs[0]); }