protected function deleteAppLogFile() { $path = Config::getAppRootPath() . '/log/app.log'; if (file_exists($path)) { unlink($path); } }
public function testLogProfile() { Config::set('hyperframework.db.operation_profiler.enable_logger', true); Config::set('hyperframework.logging.log_level', 'DEBUG'); $this->profiler->onSqlStatementExecuting($this->connection, $this->sql); $this->profiler->onSqlStatementExecuted('success'); $this->assertTrue(file_exists(Config::getAppRootPath() . '/log/app.log')); }
public function testConstruct() { $app = $this->getMockBuilder('Hyperframework\\Common\\Test\\App')->setMethods(['initializeConfig', 'initializeErrorHandler'])->disableOriginalConstructor()->getMock(); $app->expects($this->once())->method('initializeConfig'); $app->expects($this->once())->method('initializeErrorHandler'); $app->__construct('/path'); $this->assertSame('/path', Config::getAppRootPath()); }
private function writeToReadOnlyFolder() { set_error_handler(function () { }); chmod(Config::getAppRootPath() . '/log', 0555); $writer = new LogWriter(); try { $writer->write('content'); } catch (Exception $e) { restore_error_handler(); chmod(Config::getAppRootPath() . '/log', 0755); throw $e; } }
public function testGetAppRootPath() { $this->mockEngineMethod('getAppRootPath')->willReturn(true); $this->assertTrue(Config::getAppRootPath()); }