From e6709e3f3b1ed0a2626c9eb9f918588239c6a7fd Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 20 Feb 2025 18:30:44 +1300 Subject: [PATCH] FIX Reset time limit back to original value --- src/Dev/SapphireTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php index b54a58e5554..31ea1364860 100644 --- a/src/Dev/SapphireTest.php +++ b/src/Dev/SapphireTest.php @@ -163,6 +163,11 @@ abstract class SapphireTest extends TestCase implements TestOnly protected FixtureFactory|bool $fixtureFactory; + /** + * The original value of ini 'max_execution_time' before any code or tests change it + */ + private int $origMaxExecutionTime; + /** * @return TempDatabase */ @@ -332,6 +337,8 @@ protected function setUp(): void Email::config()->remove('send_all_emails_from'); Email::config()->remove('cc_all_emails_to'); Email::config()->remove('bcc_all_emails_to'); + + $this->origMaxExecutionTime = ini_get('max_execution_time'); } /** @@ -563,6 +570,10 @@ protected function tearDown(): void // Call state helpers static::$state->tearDown($this); + + // Reset max_execution_time in case some code or a unit test changed it, + // either via ini_set() or set_time_limit() + ini_set('max_execution_time', $this->origMaxExecutionTime); } /**