Example #1
0
 /**
  * @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);
 }
Example #2
0
 /**
  * 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);
     }
 }
Example #3
0
 /**
  *
  * @param string $property
  * @param mixed $value
  */
 public static function mockConf(string $property, $value)
 {
     self::inject(\Ignaszak\Exception\Conf::instance(), $property, $value);
 }
Example #4
0
 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;
     }
 }
Example #5
0
 /**
  * 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();
 }
Example #7
0
 public function tearDown()
 {
     MockTest::inject(Conf::instance(), '_conf');
 }
Example #8
0
 private function errorReporting()
 {
     if (!empty(Conf::get('errorReporting'))) {
         error_reporting(Conf::get('errorReporting'));
     }
 }
Example #9
0
 /**
  * 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;
     }
 }