You are here

public function FileSystemOperationsTest::testClean in Automatic Updates 8.2

Tests that the staging directory is properly cleaned up.

@covers \Drupal\automatic_updates\Cleaner

File

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

Class

FileSystemOperationsTest
Tests handling of files and directories during an update.

Namespace

Drupal\Tests\automatic_updates\Functional

Code

public function testClean() : void {
  $this->updater
    ->begin([
    'drupal' => '9.8.1',
  ]);

  // Make the staged site directory read-only, so we can test that it will be
  // made writable on clean-up.
  $this
    ->assertTrue(chmod("{$this->stageDir}/sites/default", 0400));
  $this
    ->assertNotIsWritable("{$this->stageDir}/sites/default/staged.txt");

  // If the site directory is not writable, this will throw an exception.
  $this->updater
    ->clean();
  $this
    ->assertDirectoryDoesNotExist($this->stageDir);
}