Changeset 38655 for trunk/tests/phpunit/tests/multisite/site.php
- Timestamp:
- 09/26/2016 06:38:32 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/site.php
r37665 r38655 927 927 } 928 928 929 /** 930 * @ticket 36918 931 */ 932 function test_new_blog_locale() { 933 $current_site = get_current_site(); 934 935 add_filter( 'sanitize_option_WPLANG', array( $this, 'filter_allow_unavailable_languages' ), 10, 3 ); 936 update_site_option( 'WPLANG', 'de_DE' ); 937 remove_filter( 'sanitize_option_WPLANG', array( $this, 'filter_allow_unavailable_languages' ), 10 ); 938 939 // No locale, use default locale. 940 add_filter( 'sanitize_option_WPLANG', array( $this, 'filter_allow_unavailable_languages' ), 10, 3 ); 941 $blog_id = wpmu_create_blog( $current_site->domain, '/de-de/', 'New Blog', get_current_user_id() ); 942 remove_filter( 'sanitize_option_WPLANG', array( $this, 'filter_allow_unavailable_languages' ), 10 ); 943 944 $this->assertNotWPError( $blog_id ); 945 $this->assertSame( 'de_DE', get_blog_option( $blog_id, 'WPLANG' ) ); 946 947 // Custom locale. 948 add_filter( 'sanitize_option_WPLANG', array( $this, 'filter_allow_unavailable_languages' ), 10, 3 ); 949 $blog_id = wpmu_create_blog( $current_site->domain, '/es-es/', 'New Blog', get_current_user_id(), array( 'WPLANG' => 'es_ES' ) ); 950 remove_filter( 'sanitize_option_WPLANG', array( $this, 'filter_allow_unavailable_languages' ), 10 ); 951 952 $this->assertNotWPError( $blog_id ); 953 $this->assertSame( 'es_ES', get_blog_option( $blog_id, 'WPLANG' ) ); 954 955 // en_US locale. 956 add_filter( 'sanitize_option_WPLANG', array( $this, 'filter_allow_unavailable_languages' ), 10, 3 ); 957 $blog_id = wpmu_create_blog( $current_site->domain, '/en-us/', 'New Blog', get_current_user_id(), array( 'WPLANG' => '' ) ); 958 remove_filter( 'sanitize_option_WPLANG', array( $this, 'filter_allow_unavailable_languages' ), 10 ); 959 960 $this->assertNotWPError( $blog_id ); 961 $this->assertSame( '', get_blog_option( $blog_id, 'WPLANG' ) ); 962 } 963 964 /** 965 * Allows to set the WPLANG option to any language. 966 * 967 * @param string $value The sanitized option value. 968 * @param string $option The option name. 969 * @param string $original_value The original value passed to the function. 970 * @return string The orginal value. 971 */ 972 function filter_allow_unavailable_languages( $value, $option, $original_value ) { 973 return $original_value; 974 } 929 975 } 930 976
Note: See TracChangeset
for help on using the changeset viewer.