Changeset 59157 for trunk/tests/phpunit/tests/l10n/loadTextdomain.php
- Timestamp:
- 10/02/2024 01:42:11 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/l10n/loadTextdomain.php
r57925 r59157 6 6 */ 7 7 class Tests_L10n_LoadTextdomain extends WP_UnitTestCase { 8 protected $locale;9 8 protected static $user_id; 10 9 … … 21 20 parent::set_up(); 22 21 23 $this->locale = '';24 25 add_filter( 'plugin_locale', array( $this, 'store_locale' ) );26 add_filter( 'theme_locale', array( $this, 'store_locale' ) );27 28 22 /** @var WP_Textdomain_Registry $wp_textdomain_registry */ 29 23 global $wp_textdomain_registry; … … 40 34 41 35 parent::tear_down(); 42 }43 44 public function store_locale( $locale ) {45 $this->locale = $locale;46 47 return $locale;48 36 } 49 37 … … 234 222 235 223 /** 236 * @covers ::load_muplugin_textdomain237 */238 public function test_load_muplugin_textdomain_site_locale() {239 load_muplugin_textdomain( 'wp-tests-domain' );240 241 $this->assertSame( get_locale(), $this->locale );242 }243 244 /**245 * @ticket 38485246 *247 * @covers ::load_muplugin_textdomain248 */249 public function test_load_muplugin_textdomain_user_locale() {250 set_current_screen( 'dashboard' );251 wp_set_current_user( self::$user_id );252 253 load_muplugin_textdomain( 'wp-tests-domain' );254 255 $this->assertSame( get_user_locale(), $this->locale );256 }257 258 /**259 * @covers ::load_plugin_textdomain260 */261 public function test_load_plugin_textdomain_site_locale() {262 load_plugin_textdomain( 'wp-tests-domain' );263 264 $this->assertSame( get_locale(), $this->locale );265 }266 267 /**268 * @ticket 38485269 *270 * @covers ::load_plugin_textdomain271 */272 public function test_load_plugin_textdomain_user_locale() {273 set_current_screen( 'dashboard' );274 wp_set_current_user( self::$user_id );275 276 load_plugin_textdomain( 'wp-tests-domain' );277 278 $this->assertSame( get_user_locale(), $this->locale );279 }280 281 /**282 * @covers ::load_theme_textdomain283 */284 public function test_load_theme_textdomain_site_locale() {285 load_theme_textdomain( 'wp-tests-domain' );286 287 $this->assertSame( get_locale(), $this->locale );288 }289 290 /**291 * @ticket 38485292 *293 * @covers ::load_theme_textdomain294 */295 public function test_load_theme_textdomain_user_locale() {296 set_current_screen( 'dashboard' );297 wp_set_current_user( self::$user_id );298 299 load_theme_textdomain( 'wp-tests-domain' );300 301 $this->assertSame( get_user_locale(), $this->locale );302 }303 304 /**305 224 * @ticket 58035 306 225 *
Note: See TracChangeset
for help on using the changeset viewer.