function DirectWriteTest::testSiteSandboxedIfDirectWriteGloballyDisabled

Tests that direct-write does not work if it is globally disabled.

File

core/modules/package_manager/tests/src/Kernel/DirectWriteTest.php, line 105

Class

DirectWriteTest
@covers \Drupal\package_manager\EventSubscriber\DirectWriteSubscriber @covers \Drupal\package_manager\SandboxManagerBase::isDirectWrite

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testSiteSandboxedIfDirectWriteGloballyDisabled() : void {
    // Even if we use a sandbox manager that supports direct write, it should
    // not be enabled.
    $sandbox_manager = $this->createStage(TestDirectWriteSandboxManager::class);
    $logger = new TestLogger();
    $sandbox_manager->setLogger($logger);
    $this->assertFalse($sandbox_manager->isDirectWrite());
    $sandbox_manager->create();
    $this->assertTrue($sandbox_manager->sandboxDirectoryExists());
    $this->assertNotSame($this->container
        ->get(PathLocator::class)
        ->getProjectRoot(), $sandbox_manager->getSandboxDirectory());
    $this->assertFalse($logger->hasRecords('info'));
}

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