|
16 | 16 | trait FilesystemTrait
|
17 | 17 | {
|
18 | 18 | private Filesystem $filesystem;
|
19 |
| - private string $varPath = ''; |
20 |
| - private string $varBackupPath = ''; |
| 19 | + private string $varTestPath = ''; |
21 | 20 |
|
22 |
| - public function backupVarDirectory(): void |
| 21 | + public function createTestVarDirectory(): void |
23 | 22 | {
|
24 |
| - $this->init(); |
25 |
| - $this->filesystem->mirror($this->varPath, $this->varBackupPath); |
26 |
| - } |
| 23 | + $shopRootPath = (new ProjectRootLocator())->getProjectRoot(); |
| 24 | + $this->filesystem = new Filesystem(); |
| 25 | + $varPath = Path::join($shopRootPath, 'var'); |
| 26 | + $this->varTestPath = Path::join($shopRootPath, getenv('OXID_VAR_DIRECTORY')); |
27 | 27 |
|
28 |
| - public function restoreVarDirectory(): void |
29 |
| - { |
30 |
| - $this->filesystem->remove($this->varPath); |
31 |
| - $this->filesystem->mirror($this->varBackupPath, $this->varPath); |
32 |
| - $this->filesystem->remove($this->varBackupPath); |
| 28 | + $this->filesystem->mirror($varPath, $this->varTestPath); |
33 | 29 | }
|
34 | 30 |
|
35 |
| - private function init(): void |
| 31 | + public function deleteTestVarDirectory(): void |
36 | 32 | {
|
37 |
| - $shopRootPath = (new ProjectRootLocator())->getProjectRoot(); |
38 |
| - $this->filesystem = new Filesystem(); |
39 |
| - $this->varPath = Path::join($shopRootPath, 'var'); |
40 |
| - $this->varBackupPath = Path::join( |
41 |
| - $shopRootPath, |
42 |
| - uniqid('var.backup.', true) |
43 |
| - ); |
| 33 | + $this->filesystem->remove($this->varTestPath); |
44 | 34 | }
|
45 | 35 | }
|
0 commit comments