diff --git a/core/modules/simpletest/simpletest.services.yml b/core/modules/simpletest/simpletest.services.yml index 0335afa5b1..c7c145e763 100644 --- a/core/modules/simpletest/simpletest.services.yml +++ b/core/modules/simpletest/simpletest.services.yml @@ -1,15 +1,9 @@ services: test_discovery: class: Drupal\simpletest\TestDiscovery - arguments: ['@app.root', '@class_loader', '@module_handler', '@?cache.simpletest'] - cache.simpletest: - class: Drupal\Core\Cache\CacheBackendInterface - tags: - - { name: cache.bin } - factory: cache_factory:get - arguments: [simpletest] + arguments: ['@app.root', '@class_loader', '@module_handler', '@?cache.discovery'] cache_context.test_discovery: class: Drupal\simpletest\Cache\Context\TestDiscoveryCacheContext - arguments: ['@test_discovery', '@private_key', '@cache.simpletest'] + arguments: ['@test_discovery', '@private_key', '@cache.discovery'] tags: - { name: cache.context} diff --git a/core/modules/simpletest/src/Cache/Context/TestDiscoveryCacheContext.php b/core/modules/simpletest/src/Cache/Context/TestDiscoveryCacheContext.php index d9f12be003..13bfc655f1 100644 --- a/core/modules/simpletest/src/Cache/Context/TestDiscoveryCacheContext.php +++ b/core/modules/simpletest/src/Cache/Context/TestDiscoveryCacheContext.php @@ -31,11 +31,11 @@ class TestDiscoveryCacheContext implements CacheContextInterface { protected $privateKey; /** - * The cache backend for simpletest. + * The cache backend for TestDiscovery. * * @var \Drupal\Core\Cache\CacheBackendInterface */ - protected $simpletestCache; + protected $discoveryCache; /** * The hash of discovered test information. @@ -56,12 +56,12 @@ class TestDiscoveryCacheContext implements CacheContextInterface { * @param \Drupal\Core\PrivateKey $private_key * The private key service. * @param \Drupal\Core\Cache\CacheBackendInterface $cache - * The simpletest cache. + * The cache backend for TestDiscovery. */ public function __construct(TestDiscovery $test_discovery, PrivateKey $private_key, CacheBackendInterface $cache) { $this->testDiscovery = $test_discovery; $this->privateKey = $private_key; - $this->simpletestCache = $cache; + $this->discoveryCache = $cache; } /** @@ -79,7 +79,7 @@ public function getContext() { // Remove TestDiscovery's internal cache so it scans the filesystem. // @todo Change this for // https://www.drupal.org/project/drupal/issues/1667822 - $this->simpletestCache->delete('simpletest:discovery:classes'); + $this->discoveryCache->delete('simpletest:discovery:classes'); $tests = $this->testDiscovery->getTestClasses(); $this->hash = $this->hash(serialize($tests)); } diff --git a/core/modules/simpletest/src/Form/SimpletestTestForm.php b/core/modules/simpletest/src/Form/SimpletestTestForm.php index 207636a47e..a8d474fc0a 100644 --- a/core/modules/simpletest/src/Form/SimpletestTestForm.php +++ b/core/modules/simpletest/src/Form/SimpletestTestForm.php @@ -32,11 +32,11 @@ class SimpletestTestForm extends FormBase { protected $testDiscovery; /** - * The simpletest cache. + * The TestDiscovery cache. * * @var \Drupal\Core\Cache\CacheBackendInterface */ - protected $simpletestCache; + protected $discoveryCache; /** * {@inheritdoc} @@ -45,7 +45,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('renderer'), $container->get('test_discovery'), - $container->get('cache.simpletest') + $container->get('cache.discovery') ); } @@ -57,12 +57,12 @@ public static function create(ContainerInterface $container) { * @param \Drupal\simpletest\TestDiscovery $test_discovery * The test discovery service. * @param \Drupal\Core\Cache\CacheBackendInterface $cache - * The simpletest cache. + * The TestDiscovery cache. */ public function __construct(RendererInterface $renderer, TestDiscovery $test_discovery, CacheBackendInterface $cache) { $this->renderer = $renderer; $this->testDiscovery = $test_discovery; - $this->simpletestCache = $cache; + $this->discoveryCache = $cache; } /** @@ -79,7 +79,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { // Clear TestDiscovery's cache. We do this to avoid a race condition within // the test_discovery cache context for this form. // @todo Change this in https://www.drupal.org/project/drupal/issues/1667822 - $this->simpletestCache->invalidate('simpletest:discovery:classes'); + $this->discoveryCache->invalidate('simpletest:discovery:classes'); $form['#cache'] = [ 'max-age' => Cache::PERMANENT,