Make WordPress Core

Changeset 1271 in tests


Ignore:
Timestamp:
04/23/2013 01:38:08 AM (12 years ago)
Author:
SergeyBiryukov
Message:

Correctly save and restore current locale settings in test_locale_floats(). see [746/tests].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/db.php

    r1108 r1271  
    5050        global $wpdb;
    5151
    52         // Save the current locale
    53         $current_locale = setlocale( LC_ALL, NULL );
     52        // Save the current locale settings
     53        $current_locales = explode( ';', setlocale( LC_ALL, 0 ) );
    5454
    5555        // Switch to Russian
     
    7676        $this->assertContains( '0.700', $sql );
    7777
    78         // Restore locale
    79         setlocale( LC_ALL, $current_locale );
     78        // Restore locale settings
     79        foreach ( $current_locales as $locale_setting ) {
     80            if ( false !== strpos( $locale_setting, '=' ) ) {
     81                list( $category, $locale ) = explode( '=', $locale_setting );
     82                setlocale( constant( $category ), $locale );
     83            } else {
     84                setlocale( LC_ALL, $locale_setting );
     85            }
     86        }
    8087    }
    8188
Note: See TracChangeset for help on using the changeset viewer.