mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Only reset test state in SapphireTest if its previously been set
That's not the case e.g. if the *first* test in a suite is skipped, so setUp() is never executed completely.
This commit is contained in:
parent
683f388d1c
commit
e8f3e7b36e
@ -460,22 +460,30 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
ini_set('memory_limit', ($this->originalMemoryLimit) ? $this->originalMemoryLimit : -1);
|
||||
|
||||
// Restore email configuration
|
||||
Email::set_mailer($this->originalMailer);
|
||||
$this->originalMailer = null;
|
||||
$this->mailer = null;
|
||||
if($this->originalMailer) {
|
||||
Email::set_mailer($this->originalMailer);
|
||||
$this->originalMailer = null;
|
||||
}
|
||||
$this->mailer = null;
|
||||
|
||||
// Restore password validation
|
||||
Member::set_password_validator($this->originalMemberPasswordValidator);
|
||||
if($this->originalMemberPasswordValidator) {
|
||||
Member::set_password_validator($this->originalMemberPasswordValidator);
|
||||
}
|
||||
|
||||
// Restore requirements
|
||||
Requirements::set_backend($this->originalRequirements);
|
||||
if($this->originalRequirements) {
|
||||
Requirements::set_backend($this->originalRequirements);
|
||||
}
|
||||
|
||||
// Mark test as no longer being run - we use originalIsRunningTest to allow for nested SapphireTest calls
|
||||
self::$is_running_test = $this->originalIsRunningTest;
|
||||
$this->originalIsRunningTest = null;
|
||||
|
||||
// Reset theme setting
|
||||
SSViewer::set_theme($this->originalTheme);
|
||||
if($this->originalTheme) {
|
||||
SSViewer::set_theme($this->originalTheme);
|
||||
}
|
||||
|
||||
// Reset mocked datetime
|
||||
SS_Datetime::clear_mock_now();
|
||||
|
Loading…
Reference in New Issue
Block a user