mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: Set up the test mailer before loading the fixture, in case fixture-creation causes emails to be generated.
This commit is contained in:
parent
c3a3ff4438
commit
b7a1db7ce3
@ -205,8 +205,16 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
$className = get_class($this);
|
$className = get_class($this);
|
||||||
$fixtureFile = eval("return {$className}::\$fixture_file;");
|
$fixtureFile = eval("return {$className}::\$fixture_file;");
|
||||||
|
|
||||||
$prefix = defined('SS_DATABASE_PREFIX') ? SS_DATABASE_PREFIX : 'ss_';
|
$prefix = defined('SS_DATABASE_PREFIX') ? SS_DATABASE_PREFIX : 'ss_';
|
||||||
|
|
||||||
|
// Set up email
|
||||||
|
$this->originalMailer = Email::mailer();
|
||||||
|
$this->mailer = new TestMailer();
|
||||||
|
Email::set_mailer($this->mailer);
|
||||||
|
Config::inst()->remove('Email', 'send_all_emails_to');
|
||||||
|
Email::send_all_emails_to(null);
|
||||||
|
|
||||||
// Todo: this could be a special test model
|
// Todo: this could be a special test model
|
||||||
$this->model = DataModel::inst();
|
$this->model = DataModel::inst();
|
||||||
|
|
||||||
@ -259,13 +267,6 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
$this->logInWithPermission("ADMIN");
|
$this->logInWithPermission("ADMIN");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up email
|
|
||||||
$this->originalMailer = Email::mailer();
|
|
||||||
$this->mailer = new TestMailer();
|
|
||||||
Email::set_mailer($this->mailer);
|
|
||||||
Config::inst()->remove('Email', 'send_all_emails_to');
|
|
||||||
Email::send_all_emails_to(null);
|
|
||||||
|
|
||||||
// Preserve memory settings
|
// Preserve memory settings
|
||||||
$this->originalMemoryLimit = ini_get('memory_limit');
|
$this->originalMemoryLimit = ini_get('memory_limit');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user