mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Ensure that Requirements backend instance is preserved between tests
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65507 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f7da9a3637
commit
648a459060
@ -13,7 +13,7 @@ class Requirements {
|
||||
* @var Requirements
|
||||
*/
|
||||
private static $backend = null;
|
||||
protected static function backend() {
|
||||
public static function backend() {
|
||||
if(!self::$backend) {
|
||||
self::$backend = new Requirements_Backend();
|
||||
|
||||
|
@ -21,6 +21,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
protected $originalMailer;
|
||||
protected $originalMemberPasswordValidator;
|
||||
protected $originalRequirements;
|
||||
|
||||
protected $mailer;
|
||||
|
||||
@ -32,6 +33,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
function setUp() {
|
||||
// Remove password validation
|
||||
$this->originalMemberPasswordValidator = Member::password_validator();
|
||||
$this->originalRequirements = Requirements::backend();
|
||||
Member::set_password_validator(null);
|
||||
|
||||
$className = get_class($this);
|
||||
@ -122,6 +124,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
// Restore password validation
|
||||
Member::set_password_validator($this->originalMemberPasswordValidator);
|
||||
|
||||
// Restore requirements
|
||||
Requirements::set_backend($this->originalRequirements);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ class SSViewerTest extends SapphireTest {
|
||||
$requirements->expects($this->once())->method('javascript')->with($jsFile);
|
||||
$requirements->expects($this->once())->method('css')->with($cssFile);
|
||||
|
||||
Requirements::set_backend($requirements);;
|
||||
Requirements::set_backend($requirements);
|
||||
|
||||
$data = new ArrayData(array());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user