mirror of
https://github.com/silverstripe/silverstripe-testsession
synced 2024-10-22 14:06:00 +02:00
Allow leaving assets in place via config
This commit is contained in:
parent
c8344b2325
commit
d8d006efdf
@ -75,6 +75,15 @@ class TestSessionEnvironment
|
|||||||
*/
|
*/
|
||||||
private static $test_state_file = 'TESTS_RUNNING.json';
|
private static $test_state_file = 'TESTS_RUNNING.json';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves assets to a backup folder when starting the test session and restores them after
|
||||||
|
* Disable this option to leave assets in place
|
||||||
|
*
|
||||||
|
* @config
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private static $move_assets = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @config
|
* @config
|
||||||
* @var [type]
|
* @var [type]
|
||||||
@ -195,6 +204,10 @@ class TestSessionEnvironment
|
|||||||
*/
|
*/
|
||||||
protected function backupAssets()
|
protected function backupAssets()
|
||||||
{
|
{
|
||||||
|
if (!$this->config()->get('move_assets')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure files backed up to assets dir
|
// Ensure files backed up to assets dir
|
||||||
$backupFolder = $this->getAssetsBackupfolder();
|
$backupFolder = $this->getAssetsBackupfolder();
|
||||||
if (!is_dir($backupFolder)) {
|
if (!is_dir($backupFolder)) {
|
||||||
@ -209,6 +222,10 @@ class TestSessionEnvironment
|
|||||||
*/
|
*/
|
||||||
public function restoreAssets()
|
public function restoreAssets()
|
||||||
{
|
{
|
||||||
|
if (!$this->config()->get('move_assets')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure files backed up to assets dir
|
// Ensure files backed up to assets dir
|
||||||
$backupFolder = $this->getAssetsBackupfolder();
|
$backupFolder = $this->getAssetsBackupfolder();
|
||||||
if (is_dir($backupFolder)) {
|
if (is_dir($backupFolder)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user