temporaryDirectory = sys_get_temp_dir() . '/ondemand-hls-test-' . bin2hex(random_bytes(8)); mkdir($this->temporaryDirectory, 0700, true); } protected function tearDown(): void { $this->removeTree($this->temporaryDirectory); parent::tearDown(); } private function removeTree(string $path): void { if (is_link($path) || is_file($path)) { @unlink($path); return; } if (!is_dir($path)) { return; } foreach (new \FilesystemIterator($path, \FilesystemIterator::SKIP_DOTS) as $item) { $this->removeTree($item->getPathname()); } @rmdir($path); } }