summaryrefslogtreecommitdiffstats
path: root/tests-skipcheck.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests-skipcheck.inc.php')
-rw-r--r--tests-skipcheck.inc.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests-skipcheck.inc.php b/tests-skipcheck.inc.php
new file mode 100644
index 0000000..0d494a9
--- /dev/null
+++ b/tests-skipcheck.inc.php
@@ -0,0 +1,29 @@
+<?php
+extension_loaded('timecop') or die('skip timecop module not available');
+if (isset($required_version)) {
+ if (version_compare(PHP_VERSION, $required_version, "<")) {
+ die("skip PHP ${required_version}+ required for this test");
+ }
+}
+if (isset($required_func)) {
+ foreach ($required_func as $func_name) {
+ if (!function_exists($func_name)) {
+ die("skip $func_name() function is not available.");
+ }
+ }
+}
+if (isset($required_class)) {
+ foreach ($required_class as $class_name) {
+ if (!class_exists($class_name)) {
+ die("skip $class_name class is not available.");
+ }
+ }
+}
+if (isset($required_method)) {
+ foreach ($required_method as $v) {
+ list($class_name, $method_name) = $v;
+ if (!method_exists($class_name, $method_name)) {
+ die("skip $class_name::$method_name() method is not available.");
+ }
+ }
+}