Пример #1
0
 public static function runAllTests()
 {
     $tests = array();
     $methods = get_class_methods(get_class());
     foreach ($methods as $method) {
         if (strpos($method, 'test') === 0) {
             $tests[] = $method;
         }
     }
     printf('<b>%s Version %s</b>%s', Settings::APP_TITLE, Helper::getOwnAppVersion(), '<br /><br />' . PHP_EOL);
     $found_errors = false;
     foreach ($tests as $number => $test) {
         $error = self::$test();
         $message = 'Passed without an error';
         if (!empty($error)) {
             $found_errors = true;
             $message = sprintf('Error: %s', $error);
         }
         printf('Ran test #%s (%s):<br />&nbsp;&nbsp;&nbsp;%s<br /><br />' . PHP_EOL, $number + 1, $test, $message);
     }
     if (!$found_errors) {
         echo 'Passed all tests. Everything seems to be set up correctly! :)';
     } else {
         echo 'Some tests failed. :(';
     }
 }