mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00: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);
|
ini_set('memory_limit', ($this->originalMemoryLimit) ? $this->originalMemoryLimit : -1);
|
||||||
|
|
||||||
// Restore email configuration
|
// Restore email configuration
|
||||||
Email::set_mailer($this->originalMailer);
|
if($this->originalMailer) {
|
||||||
$this->originalMailer = null;
|
Email::set_mailer($this->originalMailer);
|
||||||
$this->mailer = null;
|
$this->originalMailer = null;
|
||||||
|
}
|
||||||
|
$this->mailer = null;
|
||||||
|
|
||||||
// Restore password validation
|
// Restore password validation
|
||||||
Member::set_password_validator($this->originalMemberPasswordValidator);
|
if($this->originalMemberPasswordValidator) {
|
||||||
|
Member::set_password_validator($this->originalMemberPasswordValidator);
|
||||||
|
}
|
||||||
|
|
||||||
// Restore requirements
|
// 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
|
// Mark test as no longer being run - we use originalIsRunningTest to allow for nested SapphireTest calls
|
||||||
self::$is_running_test = $this->originalIsRunningTest;
|
self::$is_running_test = $this->originalIsRunningTest;
|
||||||
$this->originalIsRunningTest = null;
|
$this->originalIsRunningTest = null;
|
||||||
|
|
||||||
// Reset theme setting
|
// Reset theme setting
|
||||||
SSViewer::set_theme($this->originalTheme);
|
if($this->originalTheme) {
|
||||||
|
SSViewer::set_theme($this->originalTheme);
|
||||||
|
}
|
||||||
|
|
||||||
// Reset mocked datetime
|
// Reset mocked datetime
|
||||||
SS_Datetime::clear_mock_now();
|
SS_Datetime::clear_mock_now();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user