- Timestamp:
- 10/26/2016 03:35:58 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php
r37855 r38961 10 10 private $theme_root; 11 11 12 function setUp() {12 public function setUp() { 13 13 parent::setUp(); 14 14 … … 23 23 wp_clean_themes_cache(); 24 24 unset( $GLOBALS['wp_themes'] ); 25 25 unset( $GLOBALS['l10n'] ); 26 26 unset( $GLOBALS['l10n_unloaded'] ); 27 27 } 28 28 29 function tearDown() {29 public function tearDown() { 30 30 $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; 31 31 remove_filter( 'theme_root', array( $this, 'filter_theme_root' ) ); … … 34 34 wp_clean_themes_cache(); 35 35 unset( $GLOBALS['wp_themes'] ); 36 unset( $GLOBALS['l10n'] ); 37 unset( $GLOBALS['l10n_unloaded'] ); 36 38 37 39 parent::tearDown(); … … 61 63 $is_textdomain_loaded_after = is_textdomain_loaded( 'internationalized-plugin' ); 62 64 63 unload_textdomain( 'internationalized-plugin' );64 65 remove_filter( 'locale', array( $this, 'filter_set_locale_to_german' ) ); 65 66 … … 83 84 $is_textdomain_loaded_after = is_textdomain_loaded( 'internationalized-theme' ); 84 85 85 unload_textdomain( 'internationalized-theme' );86 86 remove_filter( 'locale', array( $this, 'filter_set_locale_to_german' ) ); 87 87 … … 142 142 $this->assertTrue( $is_textdomain_loaded_final ); 143 143 } 144 145 /** 146 * @ticket 26511 147 */ 148 public function test_plugin_translation_after_switching_locale() { 149 require_once DIR_TESTDATA . '/plugins/internationalized-plugin.php'; 150 151 switch_to_locale( 'de_DE' ); 152 $expected = i18n_plugin_test(); 153 restore_previous_locale(); 154 155 $this->assertSame( 'Das ist ein Dummy Plugin', $expected ); 156 } 157 158 /** 159 * @ticket 26511 160 */ 161 public function test_theme_translation_after_switching_locale() { 162 switch_theme( 'internationalized-theme' ); 163 164 require_once get_stylesheet_directory() . '/functions.php'; 165 166 switch_to_locale( 'de_DE' ); 167 $expected = i18n_theme_test(); 168 restore_previous_locale(); 169 170 switch_theme( WP_DEFAULT_THEME ); 171 172 $this->assertSame( 'Das ist ein Dummy Theme', $expected ); 173 } 144 174 }
Note: See TracChangeset
for help on using the changeset viewer.