Commit 4d7c3c70 authored by catch's avatar catch
Browse files

Issue #3223267 by alexpott, daffie: Remove some calls to drupal_flush_all_caches() in tests

(cherry picked from commit 8abf81e7)
parent 647ad667
...@@ -173,7 +173,7 @@ public function testLoading() { ...@@ -173,7 +173,7 @@ public function testLoading() {
$this->assertSame($expected, \Drupal::state()->get('system.css_js_query_string'), "CKEditor scripts cache-busting string is correct before flushing all caches."); $this->assertSame($expected, \Drupal::state()->get('system.css_js_query_string'), "CKEditor scripts cache-busting string is correct before flushing all caches.");
// Flush all caches then make sure that $settings['ckeditor']['timestamp'] // Flush all caches then make sure that $settings['ckeditor']['timestamp']
// still matches. // still matches.
drupal_flush_all_caches(); $this->resetAll();
$this->assertSame($expected, \Drupal::state()->get('system.css_js_query_string'), "CKEditor scripts cache-busting string is correct after flushing all caches."); $this->assertSame($expected, \Drupal::state()->get('system.css_js_query_string'), "CKEditor scripts cache-busting string is correct after flushing all caches.");
} }
......
...@@ -218,7 +218,7 @@ public function testOffCanvasStyles() { ...@@ -218,7 +218,7 @@ public function testOffCanvasStyles() {
$old_keys = $this->getSession()->evaluateScript($get_cache_keys); $old_keys = $this->getSession()->evaluateScript($get_cache_keys);
// Flush the caches to ensure the new timestamp is altered into the // Flush the caches to ensure the new timestamp is altered into the
// drupal.ckeditor library's javascript settings. // drupal.ckeditor library's javascript settings.
drupal_flush_all_caches(); $this->resetAll();
// Normally flushing caches regenerates the cache busting query string, but // Normally flushing caches regenerates the cache busting query string, but
// as it's based on the request time, it won't change within this test so // as it's based on the request time, it won't change within this test so
// explicitly set it. // explicitly set it.
......
...@@ -83,7 +83,7 @@ public function setUp(): void { ...@@ -83,7 +83,7 @@ public function setUp(): void {
'field_internal' => $this->internalEntity->id(), 'field_internal' => $this->internalEntity->id(),
]); ]);
$this->referencingEntity->save(); $this->referencingEntity->save();
drupal_flush_all_caches(); \Drupal::service('router.builder')->rebuild();
} }
/** /**
......
...@@ -191,7 +191,7 @@ protected function setUp() { ...@@ -191,7 +191,7 @@ protected function setUp() {
'administer taxonomy', 'administer taxonomy',
]); ]);
drupal_flush_all_caches(); \Drupal::service('router.builder')->rebuild();
} }
/** /**
......
...@@ -34,7 +34,7 @@ public function testLanguageConfigFactoryOverride() { ...@@ -34,7 +34,7 @@ public function testLanguageConfigFactoryOverride() {
// Invalidate the container. // Invalidate the container.
$this->config('system.site')->set('default_langcode', 'de')->save(); $this->config('system.site')->set('default_langcode', 'de')->save();
drupal_flush_all_caches(); $this->container->get('kernel')->rebuildContainer();
$config_factory_override = \Drupal::service('language.config_factory_override'); $config_factory_override = \Drupal::service('language.config_factory_override');
$this->assertEquals('de', $config_factory_override->getLanguage()->getId()); $this->assertEquals('de', $config_factory_override->getLanguage()->getId());
......
...@@ -37,7 +37,7 @@ protected function setUp(): void { ...@@ -37,7 +37,7 @@ protected function setUp(): void {
// Clear all caches so that the base field definition, its cache in the // Clear all caches so that the base field definition, its cache in the
// entity field manager, the t() cache, etc. are all cleared. // entity field manager, the t() cache, etc. are all cleared.
drupal_flush_all_caches(); $this->resetAll();
} }
/** /**
......
...@@ -99,7 +99,7 @@ public function testChanges() { ...@@ -99,7 +99,7 @@ public function testChanges() {
// @see theme_test_system_info_alter() // @see theme_test_system_info_alter()
$this->state->set('theme_test.modify_info_files', TRUE); $this->state->set('theme_test.modify_info_files', TRUE);
drupal_flush_all_caches(); $this->resetAll();
$active_theme = $this->themeManager->getActiveTheme(); $active_theme = $this->themeManager->getActiveTheme();
$this->assertEquals(['classy/base', 'classy/messages', 'core/normalize', 'test_theme/global-styling', 'core/backbone'], $active_theme->getLibraries()); $this->assertEquals(['classy/base', 'classy/messages', 'core/normalize', 'test_theme/global-styling', 'core/backbone'], $active_theme->getLibraries());
} }
......
...@@ -25,7 +25,7 @@ public function testMultipleKeysCache($translatable) { ...@@ -25,7 +25,7 @@ public function testMultipleKeysCache($translatable) {
'key_1' => 'test_field', 'key_1' => 'test_field',
'key_2' => 'test_field', 'key_2' => 'test_field',
]); ]);
drupal_flush_all_caches();
$this->installEntitySchema('entity_test'); $this->installEntitySchema('entity_test');
$entity = EntityTest::create([]); $entity = EntityTest::create([]);
......
...@@ -58,7 +58,7 @@ public function testRecursiveViolationPropagation() { ...@@ -58,7 +58,7 @@ public function testRecursiveViolationPropagation() {
->setLabel('Required string') ->setLabel('Required string')
->setRequired(TRUE); ->setRequired(TRUE);
$this->container->get('state')->set('entity_test.additional_base_field_definitions', $definitions); $this->container->get('state')->set('entity_test.additional_base_field_definitions', $definitions);
drupal_flush_all_caches();
$this->installEntitySchema('entity_test'); $this->installEntitySchema('entity_test');
$child = EntityTest::create([ $child = EntityTest::create([
'name' => 'test2', 'name' => 'test2',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment