protected function cleanupPersistentResourcesDirectory()
{
$settings = self::$bootstrap->getObjectManager()->get(ConfigurationManager::class)->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS);
$resourcesStoragePath = $settings['Neos']['Flow']['resource']['storages']['defaultPersistentResourcesStorage']['storageOptions']['path'];
if (strpos($resourcesStoragePath, FLOW_PATH_DATA) === false) {
throw new \Exception(sprintf('The storage path for persistent resources for the Testing context is "%s" but it must point to a directory below "%s". Please check the Flow settings for the Testing context.', $resourcesStoragePath, FLOW_PATH_DATA), 1382018388);
}
if (file_exists($resourcesStoragePath)) {
Files::removeDirectoryRecursively($resourcesStoragePath);
}
}