From cadf0e4613c79127a41e3c3b78b3945c2c5222c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=A9na=20Proxima?= <adam@phenaproxima.net> Date: Wed, 20 Apr 2022 11:29:49 -0400 Subject: [PATCH] See if we can not break all kernel tests --- src/CronUpdater.php | 11 ++++++++++- tests/src/Kernel/AutomaticUpdatesKernelTestBase.php | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/CronUpdater.php b/src/CronUpdater.php index 7f6400c6c5..cfd2a3d2e9 100644 --- a/src/CronUpdater.php +++ b/src/CronUpdater.php @@ -14,6 +14,15 @@ use Drupal\package_manager\Exception\StageValidationException; */ class CronUpdater extends Updater { + /** + * Whether or not cron updates are hard-disabled. + * + * @var bool + * + * @todo Remove this when TUF integration is stable. + */ + private static $disabled = TRUE; + /** * All automatic updates are disabled. * @@ -140,7 +149,7 @@ class CronUpdater extends Updater { * TRUE if cron updates are disabled, otherwise FALSE. */ private function isDisabled(): bool { - return $this->configFactory->get('automatic_updates.settings')->get('cron') === static::DISABLED; + return self::$disabled ?: $this->configFactory->get('automatic_updates.settings')->get('cron') === static::DISABLED; } } diff --git a/tests/src/Kernel/AutomaticUpdatesKernelTestBase.php b/tests/src/Kernel/AutomaticUpdatesKernelTestBase.php index de10b117ad..5b45ad63d9 100644 --- a/tests/src/Kernel/AutomaticUpdatesKernelTestBase.php +++ b/tests/src/Kernel/AutomaticUpdatesKernelTestBase.php @@ -68,6 +68,14 @@ abstract class AutomaticUpdatesKernelTestBase extends PackageManagerKernelTestBa // from a sane state. // @see \Drupal\automatic_updates\Validator\CronFrequencyValidator $this->container->get('state')->set('system.cron_last', time()); + + // @todo Remove this when TUF integration is stable. + if (class_exists(CronUpdater::class)) { + $reflector = new \ReflectionClass(CronUpdater::class); + $reflector = $reflector->getProperty('disabled'); + $reflector->setAccessible(TRUE); + $reflector->setValue(NULL, FALSE); + } } /** -- GitLab