diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php index 243f9c85b..ce4ca11fb 100644 --- a/tests/_bootstrap.php +++ b/tests/_bootstrap.php @@ -1,2 +1,38 @@ bin/grav install"); +} + +use Grav\Common\Grav; + +// Register the auto-loader. +$loader = require_once $autoload; + +if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) { + throw new \RuntimeException(sprintf('You are running PHP %s, but Grav needs at least PHP %s to run.', $ver, $req)); +} + +// Set timezone to default, falls back to system if php.ini not set +date_default_timezone_set(@date_default_timezone_get()); + +// Set internal encoding if mbstring loaded +if (!extension_loaded('mbstring')) { + throw new \RuntimeException("'mbstring' extension is not loaded. This is required for Grav to run correctly"); +} +mb_internal_encoding('UTF-8'); + +// Get the Grav instance +$grav = Grav::instance( + array( + 'loader' => $loader + ) +); diff --git a/tests/unit/_bootstrap.php b/tests/unit/_bootstrap.php index 8a8855580..f92ef0c09 100644 --- a/tests/unit/_bootstrap.php +++ b/tests/unit/_bootstrap.php @@ -1,2 +1,4 @@