function SandboxManagerBaseTest::testStoreDestroyInfo
Tests exceptions thrown because of previously destroyed stage.
@dataProvider providerStoreDestroyInfo
Parameters
bool $force: Whether the stage was forcefully destroyed.
bool $changes_applied: Whether the changes are applied.
\Drupal\Core\StringTranslation\TranslatableMarkup|null $message: A message about why the stage was destroyed or null.
string $expected_exception_message: The expected exception message string.
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ SandboxManagerBaseTest.php, line 289
Class
- SandboxManagerBaseTest
- @coversDefaultClass \Drupal\package_manager\SandboxManagerBase @group package_manager @group #slow @internal
Namespace
Drupal\Tests\package_manager\KernelCode
public function testStoreDestroyInfo(bool $force, bool $changes_applied, ?TranslatableMarkup $message, string $expected_exception_message) : void {
$stage = $this->createStage();
$stage_id = $stage->create();
$stage->require([
'drupal/core:9.8.1',
]);
$tempstore = $this->container
->get('tempstore.shared');
// Simulate whether ::apply() has run or not.
// @see \Drupal\package_manager\Stage::TEMPSTORE_CHANGES_APPLIED
$tempstore->get('package_manager_stage')
->set('changes_applied', $changes_applied);
$stage->destroy($force, $message);
// Prove the first stage was destroyed: a second stage can be created
// without an exception being thrown.
$stage2 = $this->createStage();
$stage2->create();
// Claiming the first stage always fails in this test because it was
// destroyed, but the exception message depends on why it was destroyed.
$this->expectException(SandboxException::class);
$this->expectExceptionMessage($expected_exception_message);
$stage->claim($stage_id);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.