You are here

public function FileSystemOperationsTest::testExclusions in Automatic Updates 8.2

Tests that certain files and directories are not staged.

@covers \Drupal\automatic_updates\Updater::getExclusions

File

tests/src/Functional/FileSystemOperationsTest.php, line 106

Class

FileSystemOperationsTest
Tests handling of files and directories during an update.

Namespace

Drupal\Tests\automatic_updates\Functional

Code

public function testExclusions() : void {
  $this->updater
    ->begin([
    'drupal' => '9.8.1',
  ]);
  $this
    ->assertFileDoesNotExist("{$this->stageDir}/sites/default/settings.php");
  $this
    ->assertFileDoesNotExist("{$this->stageDir}/sites/default/settings.local.php");
  $this
    ->assertFileDoesNotExist("{$this->stageDir}/sites/default/services.yml");

  // A file in sites/default, that isn't one of the site-specific settings
  // files, should be staged.
  $this
    ->assertFileExists("{$this->stageDir}/sites/default/staged.txt");
  $this
    ->assertDirectoryDoesNotExist("{$this->stageDir}/sites/simpletest");
  $this
    ->assertDirectoryDoesNotExist("{$this->stageDir}/files/public");
  $this
    ->assertDirectoryDoesNotExist("{$this->stageDir}/files/private");

  // A file that's in the general files directory, but not in the public or
  // private directories, should be staged.
  $this
    ->assertFileExists("{$this->stageDir}/files/staged.txt");
}