Loading automatic_updates_extensions/tests/src/Kernel/AutomaticUpdatesExtensionsKernelTestBase.php +7 −9 Original line number Diff line number Diff line Loading @@ -6,7 +6,9 @@ use Drupal\automatic_updates_extensions\ExtensionUpdater; use Drupal\package_manager\Event\StageEvent; use Drupal\package_manager\Exception\StageException; use Drupal\package_manager\Exception\StageValidationException; use Drupal\package_manager\Stage; use Drupal\Tests\automatic_updates\Kernel\AutomaticUpdatesKernelTestBase; use Drupal\Tests\package_manager\Kernel\TestStage; use GuzzleHttp\Client; use GuzzleHttp\Handler\MockHandler; use GuzzleHttp\HandlerStack; Loading Loading @@ -122,18 +124,14 @@ abstract class AutomaticUpdatesExtensionsKernelTestBase extends AutomaticUpdates */ class TestExtensionUpdater extends ExtensionUpdater { /** * The directory where staging areas will be created. * * @var string */ public static $stagingRoot; /** * {@inheritdoc} */ public function getStagingRoot(): string { return static::$stagingRoot ?: parent::getStagingRoot(); public function __construct(...$arguments) { parent::__construct(...$arguments); $mirror = new \ReflectionClass(Stage::class); $this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), TestStage::$stagingRoot); } /** Loading package_manager/src/Stage.php +5 −5 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ class Stage { * * @see ::getStagingRoot() */ protected const TEMPSTORE_STAGING_ROOT_KEY = 'staging_root'; private const TEMPSTORE_STAGING_ROOT_KEY = 'staging_root'; /** * The tempstore key under which to store the time that ::apply() was called. Loading Loading @@ -408,7 +408,7 @@ class Stage { protected function markAsAvailable(): void { $this->tempStore->delete(static::TEMPSTORE_METADATA_KEY); $this->tempStore->delete(static::TEMPSTORE_LOCK_KEY); $this->tempStore->delete(static::TEMPSTORE_STAGING_ROOT_KEY); $this->tempStore->delete(self::TEMPSTORE_STAGING_ROOT_KEY); $this->lock = NULL; } Loading Loading @@ -560,15 +560,15 @@ class Stage { * The absolute path of the directory containing the staging areas managed * by this class. */ protected function getStagingRoot(): string { private function getStagingRoot(): string { // Since the staging root can depend on site settings, store it so that // things won't break if the settings change during this stage's life // cycle. $dir = $this->tempStore->get(static::TEMPSTORE_STAGING_ROOT_KEY); $dir = $this->tempStore->get(self::TEMPSTORE_STAGING_ROOT_KEY); if (empty($dir)) { $site_id = $this->configFactory->get('system.site')->get('uuid'); $dir = $this->fileSystem->getTempDirectory() . DIRECTORY_SEPARATOR . '.package_manager' . $site_id; $this->tempStore->set(static::TEMPSTORE_STAGING_ROOT_KEY, $dir); $this->tempStore->set(self::TEMPSTORE_STAGING_ROOT_KEY, $dir); } return $dir; } Loading package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php +5 −2 Original line number Diff line number Diff line Loading @@ -244,8 +244,11 @@ class TestStage extends Stage { /** * {@inheritdoc} */ public function getStagingRoot(): string { return static::$stagingRoot ?: parent::getStagingRoot(); public function __construct(...$arguments) { parent::__construct(...$arguments); $mirror = new \ReflectionClass(parent::class); $this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), static::$stagingRoot); } /** Loading tests/src/Kernel/AutomaticUpdatesKernelTestBase.php +11 −4 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Drupal\Tests\automatic_updates\Kernel; use Drupal\automatic_updates\CronUpdater; use Drupal\automatic_updates\Updater; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\package_manager\Stage; use Drupal\Tests\automatic_updates\Traits\ValidationTestTrait; use Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase; use Drupal\Tests\package_manager\Kernel\TestStage; Loading Loading @@ -153,8 +154,11 @@ class TestUpdater extends Updater { /** * {@inheritdoc} */ public function getStagingRoot(): string { return TestStage::$stagingRoot ?: parent::getStagingRoot(); public function __construct(...$arguments) { parent::__construct(...$arguments); $mirror = new \ReflectionClass(Stage::class); $this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), TestStage::$stagingRoot); } } Loading @@ -167,8 +171,11 @@ class TestCronUpdater extends CronUpdater { /** * {@inheritdoc} */ public function getStagingRoot(): string { return TestStage::$stagingRoot ?: parent::getStagingRoot(); public function __construct(...$arguments) { parent::__construct(...$arguments); $mirror = new \ReflectionClass(Stage::class); $this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), TestStage::$stagingRoot); } } Loading
automatic_updates_extensions/tests/src/Kernel/AutomaticUpdatesExtensionsKernelTestBase.php +7 −9 Original line number Diff line number Diff line Loading @@ -6,7 +6,9 @@ use Drupal\automatic_updates_extensions\ExtensionUpdater; use Drupal\package_manager\Event\StageEvent; use Drupal\package_manager\Exception\StageException; use Drupal\package_manager\Exception\StageValidationException; use Drupal\package_manager\Stage; use Drupal\Tests\automatic_updates\Kernel\AutomaticUpdatesKernelTestBase; use Drupal\Tests\package_manager\Kernel\TestStage; use GuzzleHttp\Client; use GuzzleHttp\Handler\MockHandler; use GuzzleHttp\HandlerStack; Loading Loading @@ -122,18 +124,14 @@ abstract class AutomaticUpdatesExtensionsKernelTestBase extends AutomaticUpdates */ class TestExtensionUpdater extends ExtensionUpdater { /** * The directory where staging areas will be created. * * @var string */ public static $stagingRoot; /** * {@inheritdoc} */ public function getStagingRoot(): string { return static::$stagingRoot ?: parent::getStagingRoot(); public function __construct(...$arguments) { parent::__construct(...$arguments); $mirror = new \ReflectionClass(Stage::class); $this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), TestStage::$stagingRoot); } /** Loading
package_manager/src/Stage.php +5 −5 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ class Stage { * * @see ::getStagingRoot() */ protected const TEMPSTORE_STAGING_ROOT_KEY = 'staging_root'; private const TEMPSTORE_STAGING_ROOT_KEY = 'staging_root'; /** * The tempstore key under which to store the time that ::apply() was called. Loading Loading @@ -408,7 +408,7 @@ class Stage { protected function markAsAvailable(): void { $this->tempStore->delete(static::TEMPSTORE_METADATA_KEY); $this->tempStore->delete(static::TEMPSTORE_LOCK_KEY); $this->tempStore->delete(static::TEMPSTORE_STAGING_ROOT_KEY); $this->tempStore->delete(self::TEMPSTORE_STAGING_ROOT_KEY); $this->lock = NULL; } Loading Loading @@ -560,15 +560,15 @@ class Stage { * The absolute path of the directory containing the staging areas managed * by this class. */ protected function getStagingRoot(): string { private function getStagingRoot(): string { // Since the staging root can depend on site settings, store it so that // things won't break if the settings change during this stage's life // cycle. $dir = $this->tempStore->get(static::TEMPSTORE_STAGING_ROOT_KEY); $dir = $this->tempStore->get(self::TEMPSTORE_STAGING_ROOT_KEY); if (empty($dir)) { $site_id = $this->configFactory->get('system.site')->get('uuid'); $dir = $this->fileSystem->getTempDirectory() . DIRECTORY_SEPARATOR . '.package_manager' . $site_id; $this->tempStore->set(static::TEMPSTORE_STAGING_ROOT_KEY, $dir); $this->tempStore->set(self::TEMPSTORE_STAGING_ROOT_KEY, $dir); } return $dir; } Loading
package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php +5 −2 Original line number Diff line number Diff line Loading @@ -244,8 +244,11 @@ class TestStage extends Stage { /** * {@inheritdoc} */ public function getStagingRoot(): string { return static::$stagingRoot ?: parent::getStagingRoot(); public function __construct(...$arguments) { parent::__construct(...$arguments); $mirror = new \ReflectionClass(parent::class); $this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), static::$stagingRoot); } /** Loading
tests/src/Kernel/AutomaticUpdatesKernelTestBase.php +11 −4 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Drupal\Tests\automatic_updates\Kernel; use Drupal\automatic_updates\CronUpdater; use Drupal\automatic_updates\Updater; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\package_manager\Stage; use Drupal\Tests\automatic_updates\Traits\ValidationTestTrait; use Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase; use Drupal\Tests\package_manager\Kernel\TestStage; Loading Loading @@ -153,8 +154,11 @@ class TestUpdater extends Updater { /** * {@inheritdoc} */ public function getStagingRoot(): string { return TestStage::$stagingRoot ?: parent::getStagingRoot(); public function __construct(...$arguments) { parent::__construct(...$arguments); $mirror = new \ReflectionClass(Stage::class); $this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), TestStage::$stagingRoot); } } Loading @@ -167,8 +171,11 @@ class TestCronUpdater extends CronUpdater { /** * {@inheritdoc} */ public function getStagingRoot(): string { return TestStage::$stagingRoot ?: parent::getStagingRoot(); public function __construct(...$arguments) { parent::__construct(...$arguments); $mirror = new \ReflectionClass(Stage::class); $this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), TestStage::$stagingRoot); } }