Skip to content
Snippets Groups Projects

Issue #3262359: Don't catalog event subscribers as a way of determining the validity of stored results

Merged Issue #3262359: Don't catalog event subscribers as a way of determining the validity of stored results
1 file
+ 5
24
Compare changes
  • Side-by-side
  • Inline
@@ -59,9 +59,9 @@ class ReadinessValidationManagerTest extends AutomaticUpdatesKernelTestBase {
// Rebuild the container to trigger the service to be altered.
$kernel = $this->container->get('kernel');
$this->container = $kernel->rebuildContainer();
// Confirm that results will be NULL if the run() is not called again
// because the readiness checker services order has been altered.
$this->assertNull($this->getResultsFromManager());
// The stored results should be returned, even though the validators' order
// has been changed and the container has been rebuilt.
$this->assertValidationResultsEqual($expected_results_all, $this->getResultsFromManager());
// Confirm that after calling run() the expected results order has changed.
$expected_results_all_reversed = array_reverse($expected_results_all);
$this->assertCheckerResultsFromManager($expected_results_all_reversed, TRUE);
@@ -163,6 +163,7 @@ class ReadinessValidationManagerTest extends AutomaticUpdatesKernelTestBase {
/**
* @covers ::runIfNoStoredResults
* @covers ::clearStoredResults
*/
public function testRunIfNeeded(): void {
$expected_results = array_pop($this->testResults['checker_1']);
@@ -180,9 +181,7 @@ class ReadinessValidationManagerTest extends AutomaticUpdatesKernelTestBase {
// Confirm that the new results will be returned because the checkers will
// be run if the stored results are deleted.
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface $key_value */
$key_value = $this->container->get('keyvalue.expirable')->get('automatic_updates');
$key_value->delete('readiness_validation_last_run');
$manager->clearStoredResults();
$expected_results = $unexpected_results;
$manager->runIfNoStoredResults();
$this->assertCheckerResultsFromManager($expected_results);
@@ -194,24 +193,6 @@ class ReadinessValidationManagerTest extends AutomaticUpdatesKernelTestBase {
$kernel = $this->container->get('kernel');
$this->container = $kernel->rebuildContainer();
$this->assertCheckerResultsFromManager($expected_results);
// Define a constant flag that will cause the readiness checker
// service priority to be altered. This will cause the priority of
// 'automatic_updates_test.checker' to change from 2 to 4 which will be now
// higher than 'automatic_updates_test2.checker' which has a priority of 3.
// Because the list of checker IDs is not identical to the previous checker
// run runIfNoStoredValidResults() will run the checkers again.
define('PACKAGE_MANAGER_TEST_VALIDATOR_PRIORITY', 1);
// Rebuild the container to trigger the readiness checker services to be
// reordered.
$kernel = $this->container->get('kernel');
$this->container = $kernel->rebuildContainer();
$expected_results = $unexpected_results;
/** @var \Drupal\automatic_updates\Validation\ReadinessValidationManager $manager */
$manager = $this->container->get('automatic_updates.readiness_validation_manager');
$manager->runIfNoStoredResults();
$this->assertCheckerResultsFromManager($expected_results);
}
/**
Loading