Ejemplo n.º 1
0
 /**
  * @BeforeScenario @fixtures
  */
 public function removeTestSitePackages()
 {
     $directories = glob(FLOW_PATH_PACKAGES . 'Sites/Test.*');
     if (is_array($directories)) {
         foreach ($directories as $directory) {
             Files::removeDirectoryRecursively($directory);
         }
     }
 }
 /**
  * Cleans up the directory for storing persistent resources during testing
  *
  * @return void
  * @throws \Exception
  */
 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);
     }
 }
Ejemplo n.º 3
0
 /**
  * @test
  */
 public function unlinkProperlyRemovesSymlinksPointingToDirectories()
 {
     $targetPath = Files::concatenatePaths([dirname(tempnam($this->temporaryDirectory, '')), 'FlowFilesTestDirectory']);
     if (!is_dir($targetPath)) {
         Files::createDirectoryRecursively($targetPath);
     }
     $linkPath = Files::concatenatePaths([dirname(tempnam($this->temporaryDirectory, '')), 'FlowFilesTestDirectoryLink']);
     if (is_dir($linkPath)) {
         Files::removeDirectoryRecursively($linkPath);
     }
     symlink($targetPath, $linkPath);
     $this->assertTrue(Files::unlink($linkPath));
     $this->assertTrue(file_exists($targetPath));
     $this->assertFalse(file_exists($linkPath));
 }
 /**
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     Files::removeDirectoryRecursively($this->temporaryDirectory);
 }
 /**
  * Removes a package from registry and deletes it from filesystem
  *
  * @param string $packageKey package to remove
  * @return void
  * @throws Exception\UnknownPackageException if the specified package is not known
  * @throws Exception\ProtectedPackageKeyException if a package is protected and cannot be deleted
  * @throws Exception
  * @api
  */
 public function deletePackage($packageKey)
 {
     if (!$this->isPackageAvailable($packageKey)) {
         throw new Exception\UnknownPackageException('Package "' . $packageKey . '" is not available and cannot be removed.', 1166543253);
     }
     $package = $this->getPackage($packageKey);
     if ($package->isProtected()) {
         throw new Exception\ProtectedPackageKeyException('The package "' . $packageKey . '" is protected and cannot be removed.', 1220722120);
     }
     $packagePath = $package->getPackagePath();
     if ($this->isPackageActive($packageKey)) {
         $this->deactivatePackage($packageKey);
         $packagePath = Files::concatenatePaths([$this->packagesBasePath, $this->buildInactivePackageRelativePath($packagePath)]);
     }
     $this->unregisterPackage($package);
     try {
         Files::removeDirectoryRecursively($packagePath);
     } catch (UtilityException $exception) {
         throw new Exception('Please check file permissions. The directory "' . $packagePath . '" for package "' . $packageKey . '" could not be removed.', 1301491089, $exception);
     }
 }