Esempio n. 1
0
 public static function init($fileName)
 {
     if (!is_string($fileName)) {
         throw new RuntimeException('XLite_Tests_MetricWriter constructor execute with wrong $filename argument');
     }
     self::$fp = @fopen($fileName, 'a');
     if (!self::$fp) {
         throw new RuntimeException('Can\'t open ' . $fileName . ' file');
     }
 }
Esempio n. 2
0
 /**
  * Write metric log
  *
  * @return void
  * @see    ____func_see____
  * @since  1.0.0
  */
 private function writeMetricLog()
 {
     $trace = debug_backtrace();
     $trace = $trace[0];
     $class = get_called_class();
     $method = $this->getName();
     $class = str_replace(self::CLASS_PREFIX, '', empty($class) ? $trace['class'] : $class);
     $method = lcfirst(str_replace('test', '', empty($method) ? $trace['function'] : $method));
     $time = intval(round($this->end['time'] - $this->start['time'], 6) * 1000000);
     $memory = max($this->end['memory'] - $this->start['memory'], 0);
     XLite_Tests_MetricWriter::write($class, $method, $time, $memory);
 }
Esempio n. 3
0
    $arr = explode(LC_DS, realpath(__DIR__ . LC_DS . '..' . LC_DS . '..'));
    array_shift($arr);
    array_shift($arr);
    array_shift($arr);
    array_shift($arr);
    define('SELENIUM_SOURCE_URL', 'http://xcart2-530.crtdev.local/~' . posix_getlogin() . '/' . implode('/', $arr));
    unset($arr);
}
if (!defined('SELENIUM_SERVER')) {
    define('SELENIUM_SERVER', 'cormorant.crtdev.local');
}
if (!defined('TESTS_LOG_DIR')) {
    define('TESTS_LOG_DIR', LC_DIR_VAR . 'log' . LC_DS);
}
if (isset($_SERVER['argv']) && preg_match('/--log-xml\\s+(\\S+)\\s/s', implode(' ', $_SERVER['argv']), $match)) {
    XLite_Tests_MetricWriter::init($match[1] . '.speed');
    unset($match);
}
if (!defined('INCLUDE_ONLY_TESTS') || !preg_match('/DEPLOY_/', constant('INCLUDE_ONLY_TESTS'))) {
    PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_ROOT . LC_DS . '.dev');
    PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_SRC . LC_DS . 'etc');
    PHP_CodeCoverage_Filter::getInstance()->addDirectoryToWhitelist(PATH_SRC . LC_DS . 'var' . LC_DS . 'run' . LC_DS . 'classes');
    PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_SRC . LC_DS . 'var' . LC_DS . 'run' . LC_DS . 'classes' . LC_DS . 'XLite' . LC_DS . 'Model' . LC_DS . 'Proxy');
}
foreach (glob(LC_DIR_ROOT . 'var/log/selenium.*.html') as $f) {
    @unlink($f);
}
/**
 * Class to sort out files gathered by RecursiveIteratorIterator
 *
 * @package    X-Lite_Tests