From 559517e0173b36cb546c0b3b806a58d82e2cbdcf Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 14 Dec 2022 00:53:43 +0100 Subject: [PATCH] Ignore the timezone configured in php.ini, better cleanup after feature tests --- config/config.default.php | 2 +- tests/Feature/ApplicationFeatureTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/config/config.default.php b/config/config.default.php index c4329071..f438f507 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -286,7 +286,7 @@ return [ 'max_freeloadable_shifts' => env('MAX_FREELOADABLE_SHIFTS', 2), // Local timezone - 'timezone' => env('TIMEZONE', ini_get('date.timezone') ?: 'Europe/Berlin'), + 'timezone' => env('TIMEZONE', 'Europe/Berlin'), // Multiply 'night shifts' and freeloaded shifts (start or end between 2 and 6 exclusive) by 2 'night_shifts' => [ diff --git a/tests/Feature/ApplicationFeatureTest.php b/tests/Feature/ApplicationFeatureTest.php index 6ac42bce..27d39f51 100644 --- a/tests/Feature/ApplicationFeatureTest.php +++ b/tests/Feature/ApplicationFeatureTest.php @@ -11,4 +11,18 @@ abstract class ApplicationFeatureTest extends TestCase $_SERVER['HTTP_HOST'] = 'foo.bar'; require __DIR__ . '/../../includes/engelsystem.php'; } + + /** + * Undo the changes done by the ConfigureEnvironmentServiceProvider + */ + protected function tearDown(): void + { + parent::tearDown(); + + ini_set('display_errors', true); + error_reporting(E_ALL); + + ini_set('date.timezone', 'UTC'); + date_default_timezone_set('UTC'); + } }