Skip to content

Commit

Permalink
FIX Reset time limit back to original value
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Feb 20, 2025
1 parent 4a84796 commit e6709e3
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 e6709e3

Please sign in to comment.