Skip to content
Snippets Groups Projects
Unverified Commit a02a2715 authored by Ted Bowman's avatar Ted Bowman
Browse files

use test class var instead of TestStage

parent 585984b8
No related branches found
No related tags found
1 merge request!304Issue #3279064: Consolidate logic around test stages
This commit is part of merge request !304. Comments created here will be created in the context of that merge request.
......@@ -31,6 +31,17 @@ abstract class PackageManagerKernelTestBase extends KernelTestBase {
'package_manager_bypass',
];
/**
* The test staging root.
*
* This value must be set before create an test stage instance.
*
* @var string
*
* @see \Drupal\Tests\package_manager\Kernel\TestStageTrait::setStagingRoot()
*/
public static $testStagingRoot;
/**
* The service IDs of any validators to disable.
*
......@@ -175,7 +186,7 @@ abstract class PackageManagerKernelTestBase extends KernelTestBase {
// Create a staging root directory alongside the active directory.
$stage_dir = vfsStream::newDirectory('stage');
$this->vfsRoot->addChild($stage_dir);
TestStage::$stagingRoot = $stage_dir->url();
static::$testStagingRoot = $stage_dir->url();
$path_locator = $this->mockPathLocator($active_dir->url());
......@@ -254,7 +265,7 @@ trait TestStageTrait {
*/
protected function setStagingRoot(): void {
$mirror = new \ReflectionClass(Stage::class);
$this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), TestStage::$stagingRoot);
$this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), PackageManagerKernelTestBase::$testStagingRoot);
}
/**
......
......@@ -36,7 +36,7 @@ class StagedDatabaseUpdateValidatorTest extends AutomaticUpdatesKernelTestBase {
$this->disableValidators[] = 'package_manager.validator.lock_file';
parent::setUp();
TestStage::$stagingRoot = $this->vfsRoot->url();
static::$testStagingRoot = $this->vfsRoot->url();
/** @var \Drupal\Tests\automatic_updates\Kernel\TestCronUpdater $updater */
$updater = $this->container->get('automatic_updates.cron_updater');
......
......@@ -52,12 +52,12 @@ class StagedProjectsValidatorTest extends AutomaticUpdatesKernelTestBase {
// subdirectory using the stage ID after it is created below.
$stage_vfs_dir = vfsStream::newDirectory('au_stage');
$this->vfsRoot->addChild($stage_vfs_dir);
TestStage::$stagingRoot = $stage_vfs_dir->url();
static::$testStagingRoot = $stage_vfs_dir->url();
}
else {
// If we are testing non-existent staging directory we can use the path
// directly.
TestStage::$stagingRoot = $stage_dir;
static::$testStagingRoot = $stage_dir;
}
$updater = $this->container->get('automatic_updates.updater');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment