You are here

protected function BuildTestBase::tearDown in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::tearDown()

File

core/tests/Drupal/BuildTests/Framework/BuildTestBase.php, line 172

Class

BuildTestBase
Provides a workspace to test build processes.

Namespace

Drupal\BuildTests\Framework

Code

protected function tearDown() {
  parent::tearDown();
  $this
    ->stopServer();
  foreach ($this->portLocks as $lock) {
    $lock
      ->release();
  }
  $ws = $this
    ->getWorkspaceDirectory();
  $fs = new SymfonyFilesystem();
  if ($this->destroyBuild && $fs
    ->exists($ws)) {

    // Filter out symlinks as chmod cannot alter them.
    $finder = new Finder();
    $finder
      ->in($ws)
      ->directories()
      ->ignoreVCS(FALSE)
      ->ignoreDotFiles(FALSE)
      ->notPath('/^vendor\\/bin\\/composer$/');
    $fs
      ->chmod($finder
      ->getIterator(), 0775, 00);
    $fs
      ->remove($ws);
  }
}