From 6633bde9e9cb895136c43f14542d363591ad81cf Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 26 Oct 2021 14:43:23 +0200 Subject: [PATCH] tests: Load Mockery as late as possible --- test/php/bootstrap.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/php/bootstrap.php b/test/php/bootstrap.php index bc861c695..7757d8562 100644 --- a/test/php/bootstrap.php +++ b/test/php/bootstrap.php @@ -27,11 +27,6 @@ set_include_path(implode(PATH_SEPARATOR, [ $vendorAutoload = $basePath . '/vendor/autoload.php'; if (file_exists($vendorAutoload)) { require_once $vendorAutoload; -} else { - require_once 'Mockery/Loader.php'; - - $mockeryLoader = new \Mockery\Loader; - $mockeryLoader->register(); } require_once($icingaLibPath . '/Test/ClassLoader.php'); @@ -117,6 +112,13 @@ set_include_path( ) ); +if (! class_exists('Mockery')) { + require_once 'Mockery/Loader.php'; + + $mockeryLoader = new \Mockery\Loader; + $mockeryLoader->register(); +} + require_once 'Zend/Loader/Autoloader.php'; \Zend_Loader_Autoloader::getInstance();