diff --git a/src/Functions.php b/src/Functions.php index 37a053a..0bc6a6f 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -56,6 +56,10 @@ protected function restoreFunctions() */ protected function defineFunction($name, \Closure $closure) { + if (! Runkit::isAvailable()) { + $this->markTestSkipped('defineFunction() requires Runkit be available, skipping.'); + } + if (function_exists($name)) { throw new FunctionExistsException(sprintf( 'Function %1$s() already exists. You may redefine it using %2$s::redefineFunction() instead.', @@ -130,6 +134,10 @@ protected function deleteFunction($name) return $this; } + if (! Runkit::isAvailable()) { + $this->markTestSkipped('deleteFunction() requires Runkit be available, skipping.'); + } + $namespaced = Runkit::makeNamespaced($name); if (! Runkit::function_rename($name, $namespaced)) {