/** * @ticket 34114 */ public function test_theme_translation_should_be_translated_without_calling_load_theme_textdomain() { add_filter('locale', array($this, 'filter_set_locale_to_german')); switch_theme('internationalized-theme'); include_once get_stylesheet_directory() . '/functions.php'; $is_textdomain_loaded_before = is_textdomain_loaded('internationalized-theme'); $expected_output = i18n_theme_test(); $is_textdomain_loaded_after = is_textdomain_loaded('internationalized-theme'); unload_textdomain('internationalized-theme'); remove_filter('locale', array($this, 'filter_set_locale_to_german')); $this->assertFalse($is_textdomain_loaded_before); $this->assertSame('Das ist ein Dummy Theme', $expected_output); $this->assertTrue($is_textdomain_loaded_after); }
/** * @ticket 38485 */ public function test_theme_translation_with_user_locale() { switch_theme('internationalized-theme'); set_current_screen('dashboard'); wp_set_current_user(self::$user_id); require_once get_stylesheet_directory() . '/functions.php'; $expected = i18n_theme_test(); set_current_screen('front'); switch_theme(WP_DEFAULT_THEME); $this->assertSame('Das ist ein Dummy Theme', $expected); }