From d8d006efdf12c8672923bb361b32b8638e29efca Mon Sep 17 00:00:00 2001 From: Bernie Hamlin Date: Tue, 7 Sep 2021 18:58:12 +1200 Subject: [PATCH] Allow leaving assets in place via config --- src/TestSessionEnvironment.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/TestSessionEnvironment.php b/src/TestSessionEnvironment.php index e8e8bf0..4e6980b 100644 --- a/src/TestSessionEnvironment.php +++ b/src/TestSessionEnvironment.php @@ -75,6 +75,15 @@ class TestSessionEnvironment */ 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 * @var [type] @@ -195,6 +204,10 @@ class TestSessionEnvironment */ protected function backupAssets() { + if (!$this->config()->get('move_assets')) { + return; + } + // Ensure files backed up to assets dir $backupFolder = $this->getAssetsBackupfolder(); if (!is_dir($backupFolder)) { @@ -209,6 +222,10 @@ class TestSessionEnvironment */ public function restoreAssets() { + if (!$this->config()->get('move_assets')) { + return; + } + // Ensure files backed up to assets dir $backupFolder = $this->getAssetsBackupfolder(); if (is_dir($backupFolder)) {