Description

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
				protected function _cleanUp($path = null) {
		$path = $path ?: LITHIUM_APP_PATH . '/resources/tmp/tests';
		$path = $path[0] !== '/' ? LITHIUM_APP_PATH . '/resources/tmp/' . $path : $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") {
				continue;
			}
			($item->isDir()) ? rmdir($item->getPathname()) : unlink($item->getPathname());
		}
	}