| | 1 | <?php |
| | 2 | /** |
| | 3 | * wordpress-develop. |
| | 4 | * User: Paul |
| | 5 | * Date: 2016-05-16 |
| | 6 | * |
| | 7 | */ |
| | 8 | |
| | 9 | if ( !defined( 'WPINC' ) ) { |
| | 10 | die; |
| | 11 | } |
| | 12 | |
| | 13 | class test_Locale extends WP_UnitTestCase { |
| | 14 | |
| | 15 | static $fr_lanf_files = array( |
| | 16 | 'admin-fr_FR.mo', |
| | 17 | 'admin-fr_FR.po', |
| | 18 | 'admin-network-fr_FR.mo', |
| | 19 | 'admin-network-fr_FR.po', |
| | 20 | 'continents-cities-fr_FR.mo', |
| | 21 | 'continents-cities-fr_FR.po', |
| | 22 | 'fr_FR.mo', |
| | 23 | 'fr_FR.po', |
| | 24 | ); |
| | 25 | |
| | 26 | |
| | 27 | /** |
| | 28 | * pass a new locale into WP_locale and reset current locale |
| | 29 | */ |
| | 30 | function test_WP_locale(){ |
| | 31 | |
| | 32 | global $GLOBALS; |
| | 33 | |
| | 34 | $GLOBALS['wp_locale'] = new WP_Locale( 'fr_FR' ); |
| | 35 | |
| | 36 | $this->assertEquals( 'fr_FR', get_locale() ); |
| | 37 | |
| | 38 | $this->assertEquals( 'dimanche', $GLOBALS['wp_locale']->weekday[0] ); |
| | 39 | |
| | 40 | foreach ( self::$fr_lanf_files as $file ) { |
| | 41 | $this->assertEquals( true, file_exists( WP_LANG_DIR . '/' . $file ) ); |
| | 42 | } |
| | 43 | |
| | 44 | // remove any fr lang files |
| | 45 | $this->remove_lang_files(); |
| | 46 | } |
| | 47 | |
| | 48 | function remove_lang_files() { |
| | 49 | foreach ( self::$fr_lanf_files as $file ) { |
| | 50 | $this->unlink( WP_LANG_DIR . '/' . $file ); |
| | 51 | } |
| | 52 | } |
| | 53 | } |