function testLintErrors() { $exit = 0; $root = get_osticket_root_path(); foreach (glob_recursive("$root/*.js") as $s) { ob_start(); system("jsl -process $s", $exit); $line = ob_get_contents(); ob_end_clean(); if ($exit == 3) $this->fail($s, 0, $line); else $this->pass(); } }
static function getAllScripts($excludes=true, $root=false) { $root = $root ?: get_osticket_root_path(); $scripts = array(); foreach (glob_recursive("$root/*.php") as $s) { $found = false; if ($excludes) { foreach (self::$third_party_paths as $p) { if (strpos($s, $p) !== false) { $found = true; break; } } } if (!$found) $scripts[] = $s; } return $scripts; }
require_once "tests/class.test.php"; if (!function_exists('get_osticket_root_path')) { function get_osticket_root_path() { # Hop up to the root folder $start = dirname(__FILE__); for (;;) { if (file_exists($start . '/main.inc.php')) { break; } $start .= '/..'; } return realpath($start); } } $root = get_osticket_root_path(); if (!function_exists('glob_recursive')) { # Check PHP syntax across all php files function glob_recursive($pattern, $flags = 0) { $files = glob($pattern, $flags); foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { $files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags)); } return $files; } } $fails = array(); function show_fails() { global $fails, $root;