function SandboxManagerBaseTest::testTempStoreMessageExpired
Tests exception message once temp store message has expired.
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ SandboxManagerBaseTest.php, line 314
Class
- SandboxManagerBaseTest
- @coversDefaultClass \Drupal\package_manager\SandboxManagerBase @group package_manager @group #slow @internal
Namespace
Drupal\Tests\package_manager\KernelCode
public function testTempStoreMessageExpired() : void {
$stage = $this->createStage();
$stage_id = $stage->create();
$stage->require([
'drupal/core:9.8.1',
]);
$stage->destroy(TRUE, $this->t('Force destroy stage.'));
// Delete the tempstore message stored for the previously destroyed stage.
$tempstore = $this->container
->get('tempstore.shared');
// @see \Drupal\package_manager\Stage::TEMPSTORE_DESTROYED_STAGES_INFO_PREFIX
$tempstore->get('package_manager_stage')
->delete('TEMPSTORE_DESTROYED_STAGES_INFO' . $stage_id);
// Claiming the stage will fail, but we won't get the message we set in
// \Drupal\package_manager\Stage::storeDestroyInfo() as we are deleting it
// above.
$this->expectException(SandboxException::class);
$this->expectExceptionMessage('Cannot claim the stage because no stage has been created.');
$stage->claim($stage_id);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.