Removes everything from `resources/tmp/tests` directory. Call from inside of your test method or `tearDown()`.

Parameters

  • string $path path to directory of contents to remove if first character is NOT `/` prepend `LITHIUM_APP_PATH/resources/tmp/`

Returns

void

Source

						protected function _cleanUp($path = null) {
		$resources = Libraries::get(true, 'resources');
		$path = $path ?: $resources . '/tmp/tests';
		$path = preg_match('/^\w:|^\//', $path) ? $path : $resources . '/tmp/' . $path;

		if (!is_dir($path)) {
			return;
		}
		$dirs = new RecursiveDirectoryIterator($path);
		$iterator = new RecursiveIteratorIterator($dirs, RecursiveIteratorIterator::CHILD_FIRST);

		foreach ($iterator as $item) {
			if ($item->getPathname() === "{$path}/empty" || $iterator->isDot()) {
				continue;
			}
			($item->isDir()) ? rmdir($item->getPathname()) : unlink($item->getPathname());
		}
	}