public function test_multiple_switches_to_site_locale_and_user_locale()
 {
     global $wp_locale_switcher;
     $site_locale = get_locale();
     $user_id = $this->factory()->user->create(array('role' => 'administrator', 'locale' => 'en_GB'));
     wp_set_current_user($user_id);
     set_current_screen('dashboard');
     $locale_switcher = clone $wp_locale_switcher;
     $wp_locale_switcher = new WP_Locale_Switcher();
     $wp_locale_switcher->init();
     $user_locale = get_user_locale();
     load_default_textdomain($user_locale);
     require_once DIR_TESTDATA . '/plugins/internationalized-plugin.php';
     switch_to_locale('de_DE');
     switch_to_locale($site_locale);
     $expected = i18n_plugin_test();
     restore_current_locale();
     $wp_locale_switcher = $locale_switcher;
     set_current_screen('front');
     $this->assertSame('en_US', get_locale());
     $this->assertSame('This is a dummy plugin', $expected);
 }
 /**
  * @ticket 37997
  */
 public function test_plugin_translation_after_switching_locale_twice()
 {
     require_once DIR_TESTDATA . '/plugins/internationalized-plugin.php';
     switch_to_locale('de_DE');
     $expected_de_DE = i18n_plugin_test();
     switch_to_locale('es_ES');
     $expected_es_ES = i18n_plugin_test();
     restore_current_locale();
     $this->assertSame('Das ist ein Dummy Plugin', $expected_de_DE);
     $this->assertSame('This is a dummy plugin', $expected_es_ES);
 }