function SandboxManagerBaseTest::testStageDirectoryExists

Tests stage directory exists.

@legacy-covers ::sandboxDirectoryExists

File

core/modules/package_manager/tests/src/Kernel/SandboxManagerBaseTest.php, line 461

Class

SandboxManagerBaseTest
Tests Drupal\package_manager\SandboxManagerBase.

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testStageDirectoryExists() : void {
  // Ensure that stageDirectoryExists() returns an accurate result during
  // pre-create.
  $listener = function (SandboxEvent $event) : void {
    $stage = $event->sandboxManager;
    // The directory should not exist yet, because we are still in pre-create.
    $this->assertDirectoryDoesNotExist($stage->getSandboxDirectory());
    $this->assertFalse($stage->sandboxDirectoryExists());
  };
  $this->addEventTestListener($listener, PreCreateEvent::class);
  $stage = $this->createStage();
  $this->assertFalse($stage->sandboxDirectoryExists());
  $stage->create();
  $this->assertTrue($stage->sandboxDirectoryExists());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.