/** * @runInSeparateProcess */ public function testLoadLocation() { define('TEST_MODE', true); $location = 'http://example.com'; $_conf = Conf::instance(); $_conf->setProperty('userLocation', $location); $_conf->setProperty('display', 'location'); $this->display->loadLocation(); $headers_list = xdebug_get_headers(); $this->assertContains("Location: {$location}", $headers_list); }
/** * Gathers informations about Server, execution environment, occured errors * and creates log files */ public function createLogFile() { $logDir = Conf::get('logFileDir'); if (is_writable($logDir) && Conf::get('createLogFile')) { $logDisplayArray = $this->loadLogDisplay(); $header = "ignaszak/exception - https://github.com/ignaszak/\n" . sprintf("%-17.17s %s", "Date:", date('F d Y H:i:s')) . "\n" . sprintf("%-17.17s %s", "Reported errors:", $logDisplayArray['errorsCount']); $globalVars = Variable::getFormatedServerDataAsString(); $content = strip_tags("{$header}\n\n\n{$globalVars}\n\n\n{$logDisplayArray['errors']}"); $fileName = date('Y_m_d_H_i_s_u', time()) . '.log'; file_put_contents("{$logDir}/{$fileName}", $content); chmod("{$logDir}/{$fileName}", 0664); } }
/** * * @param string $property * @param mixed $value */ public static function mockConf(string $property, $value) { self::inject(\Ignaszak\Exception\Conf::instance(), $property, $value); }
private function getInf(string $inf) : string { switch ($inf) { case 'time': return date('G:i:s', time()); break; case 'path': return Conf::get('logFileDir'); break; case 'log': return Conf::get('createLogFile') ? 'yes' : 'no'; break; } }
/** * Returns true if occcured error level is defined in 'userReporting' setting * * @return boolean */ private function isUserReporting() : bool { return (bool) (self::$reportedErrorCode & Conf::get('userReporting')); }
public function setUp() { Conf::instance(); $this->_exceptionHandler = new ExceptionHandler(); }
public function tearDown() { MockTest::inject(Conf::instance(), '_conf'); }
private function errorReporting() { if (!empty(Conf::get('errorReporting'))) { error_reporting(Conf::get('errorReporting')); } }
/** * Returns true if occcured error level is defined in 'userReporting' setting * * @return boolean */ private function isUserReporting() : bool { if (self::$reportedErrorCode & Conf::get('userReporting')) { return true; } else { return false; } }