Skip to content

Commit

Permalink
Merge pull request #11621 from creative-commoners/pulls/5.3/time-limit
Browse files Browse the repository at this point in the history
FIX Reset time limit back to original value
  • Loading branch information
GuySartorelli authored Feb 20, 2025
2 parents 4a84796 + e6709e3 commit ec50c5c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Dev/SapphireTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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');
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit ec50c5c

Please sign in to comment.