| Total Complexity | 9 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class AVolume extends CommonTestClass |
||
| 13 | { |
||
| 14 | protected function setUp(): void |
||
| 15 | { |
||
| 16 | $this->clearData(); |
||
| 17 | } |
||
| 18 | |||
| 19 | protected function tearDown(): void |
||
| 20 | { |
||
| 21 | $this->clearData(); |
||
| 22 | } |
||
| 23 | |||
| 24 | protected function clearData(): void |
||
| 25 | { |
||
| 26 | clearstatcache(); |
||
| 27 | $this->rmFile('another' . DIRECTORY_SEPARATOR . 'sub_one' . DIRECTORY_SEPARATOR . '.gitkeep'); |
||
| 28 | $this->rmDir('another' . DIRECTORY_SEPARATOR . 'sub_one'); |
||
| 29 | $this->rmDir('another'); |
||
| 30 | clearstatcache(); |
||
| 31 | $this->rmDir('sub' . DIRECTORY_SEPARATOR . 'added'); |
||
| 32 | $this->rmDir('more' . DIRECTORY_SEPARATOR . 'added'); |
||
| 33 | clearstatcache(); |
||
| 34 | $this->rmFile('more' . DIRECTORY_SEPARATOR . 'sub_one' . DIRECTORY_SEPARATOR . '.gitkeep'); |
||
| 35 | $this->rmDir('more' . DIRECTORY_SEPARATOR . 'sub_one'); |
||
| 36 | $this->rmDir('more'); |
||
| 37 | clearstatcache(); |
||
| 38 | } |
||
| 39 | |||
| 40 | protected function rmDir(string $path): void |
||
| 41 | { |
||
| 42 | if (is_dir($this->getTestPath() . DIRECTORY_SEPARATOR . $path)) { |
||
| 43 | rmdir($this->getTestPath() . DIRECTORY_SEPARATOR . $path); |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | protected function rmFile(string $path): void |
||
| 48 | { |
||
| 49 | if (is_file($this->getTestPath() . DIRECTORY_SEPARATOR . $path)) { |
||
| 50 | unlink($this->getTestPath() . DIRECTORY_SEPARATOR . $path); |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @throws PathsException |
||
| 56 | * @return IProcessDirs |
||
| 57 | */ |
||
| 58 | protected function getDirLib(): IProcessDirs |
||
| 59 | { |
||
| 60 | return new ProcessDir($this->getTestPath()); |
||
| 61 | } |
||
| 62 | |||
| 63 | protected function getTestPath(): string |
||
| 64 | { |
||
| 65 | return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'tree'; |
||
| 66 | } |
||
| 68 |