Example #1
0
 private static function injectIntoPhpunit()
 {
     if (!class_exists(\PHPUnit_Util_Fileloader::class, false)) {
         return;
     }
     if (!is_callable([\PHPUnit_Util_Fileloader::class, 'setFilenameRewriteCallback'])) {
         if (self::$debug) {
             self::debug("Cannot inject into phpunit: method setFilenameRewriteCallback not found");
         }
         return;
     }
     \PHPUnit_Util_Fileloader::setFilenameRewriteCallback([self::class, 'rewrite']);
     \PHPUnit_Util_Fileloader::setFilenameRestoreCallback(function ($filename) {
         return self::replaceFilename($filename, true);
     });
     \PHPUnit_Util_Filter::setCustomStackTraceCallback(function ($e) {
         ob_start();
         self::printBackTrace($e);
         return ob_get_clean();
     });
 }