function DirectWriteTest::testDirectWriteFlagIsLocked

Tests that the sandbox's direct-write status is part of its locking info.

File

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

Class

DirectWriteTest
@covers \Drupal\package_manager\EventSubscriber\DirectWriteSubscriber[[api-linebreak]] @covers \Drupal\package_manager\SandboxManagerBase::isDirectWrite[[api-linebreak]] @covers \Drupal\package_manager\DirectWritePreconditionBypass[[api-linebreak]]

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testDirectWriteFlagIsLocked() : void {
  $this->setSetting('package_manager_allow_direct_write', TRUE);
  $sandbox_manager = $this->createStage(TestDirectWriteSandboxManager::class);
  $this->assertTrue($sandbox_manager->isDirectWrite());
  $sandbox_manager->create();
  $this->setSetting('package_manager_allow_direct_write', FALSE);
  $this->assertTrue($sandbox_manager->isDirectWrite());
  // Only once the sandbox is destroyed should the sandbox manager reflect the
  // changed setting.
  $sandbox_manager->destroy();
  $this->assertFalse($sandbox_manager->isDirectWrite());
}

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