/** * Just the classes from the first autorun script. May * get a few false positives, as it just does a regex based * on following the word "class". * @return array List of all possible classes in first * autorun script. */ function classes_defined_in_initial_file() { if (preg_match_all('/\\bclass\\s+(\\w+)/i', file_get_contents(initial_file()), $matches)) { return array_map('strtolower', $matches[1]); } return array(); }
/** * run all recent test cases if no test has * so far been run. Uses the DefaultReporter which can have * it's output controlled with SimpleTest::prefer(). */ function run_local_tests() { try { $candidates = capture_new_classes(); $loader = new SimpleFileLoader(); $suite = $loader->createSuiteFromClasses(basename(initial_file()), $loader->selectRunnableTests($candidates)); $result = $suite->run(new DefaultReporter()); } catch (Exception $stack_frame_fix) { print $stack_frame_fix->getMessage(); $result = false; } }