mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Implement Resettable interface on SubsiteState so it gets reset between unit tests
This commit is contained in:
parent
c2a81f76ae
commit
a2a86c6eb1
@ -4,11 +4,12 @@ namespace SilverStripe\Subsites\State;
|
|||||||
|
|
||||||
use SilverStripe\Core\Injector\Injectable;
|
use SilverStripe\Core\Injector\Injectable;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
|
use SilverStripe\Core\Resettable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SubsiteState provides static access to the current state for subsite related data during a request
|
* SubsiteState provides static access to the current state for subsite related data during a request
|
||||||
*/
|
*/
|
||||||
class SubsiteState
|
class SubsiteState implements Resettable
|
||||||
{
|
{
|
||||||
use Injectable;
|
use Injectable;
|
||||||
|
|
||||||
@ -106,4 +107,22 @@ class SubsiteState
|
|||||||
Injector::inst()->registerService($this);
|
Injector::inst()->registerService($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the local cache of the singleton
|
||||||
|
*/
|
||||||
|
public static function reset()
|
||||||
|
{
|
||||||
|
SubsiteState::singleton()->resetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the local cache of this object
|
||||||
|
*/
|
||||||
|
public function resetState()
|
||||||
|
{
|
||||||
|
$this->originalSubsiteId = null;
|
||||||
|
$this->subsiteId = null;
|
||||||
|
$this->useSessions = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user