Changeset 29916 for trunk/tests/phpunit/tests/option/multisite.php
- Timestamp:
- 10/16/2014 05:06:22 AM (10 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/option/multisite.php
r29881 r29916 2 2 3 3 if ( is_multisite() ) : 4 4 5 /** 6 * Tests specific to network and site options in Multisite. 7 * 5 8 * @group option 9 * @group ms-option 10 * @group multisite 6 11 */ 7 class Tests_ Option_BlogOption extends WP_UnitTestCase {12 class Tests_Multisite_Option extends WP_UnitTestCase { 8 13 protected $suppress = false; 9 14 … … 151 156 //$this->assertFalse( get_option( $key2 ) ); // check get_option() 152 157 } 158 159 /** 160 * @group multisite 161 */ 162 function test_site_notoptions() { 163 global $wpdb; 164 $notoptions_key = "{$wpdb->siteid}:notoptions"; 165 166 $_notoptions = wp_cache_get( 'notoptions', 'site-options' ); 167 $this->assertEmpty( $_notoptions ); 168 $_notoptions1 = wp_cache_get( $notoptions_key, 'site-options' ); 169 $this->assertEmpty( $_notoptions1 ); 170 171 get_site_option( 'burrito' ); 172 173 $notoptions = wp_cache_get( 'notoptions', 'site-options' ); 174 $this->assertEmpty( $notoptions ); 175 $notoptions1 = wp_cache_get( $notoptions_key, 'site-options' ); 176 $this->assertNotEmpty( $notoptions1 ); 177 } 178 179 function test_users_can_register_signup_filter() { 180 181 $registration = get_site_option('registration'); 182 $this->assertFalse( users_can_register_signup_filter() ); 183 184 update_site_option('registration', 'all'); 185 $this->assertTrue( users_can_register_signup_filter() ); 186 187 update_site_option('registration', 'user'); 188 $this->assertTrue( users_can_register_signup_filter() ); 189 190 update_site_option('registration', 'none'); 191 $this->assertFalse( users_can_register_signup_filter() ); 192 } 193 194 /** 195 * @ticket 21552 196 * @ticket 23418 197 */ 198 function test_sanitize_ms_options() { 199 update_site_option( 'illegal_names', array( '', 'Woo', '' ) ); 200 update_site_option( 'limited_email_domains', array( 'woo', '', 'boo.com', 'foo.net.biz..' ) ); 201 update_site_option( 'banned_email_domains', array( 'woo', '', 'boo.com', 'foo.net.biz..' ) ); 202 203 $this->assertEquals( array( 'Woo' ), get_site_option( 'illegal_names' ) ); 204 $this->assertEquals( array( 'woo', 'boo.com' ), get_site_option( 'limited_email_domains' ) ); 205 $this->assertEquals( array( 'woo', 'boo.com' ), get_site_option( 'banned_email_domains' ) ); 206 207 update_site_option( 'illegal_names', 'foo bar' ); 208 update_site_option( 'limited_email_domains', "foo\nbar" ); 209 update_site_option( 'banned_email_domains', "foo\nbar" ); 210 211 $this->assertEquals( array( 'foo', 'bar' ), get_site_option( 'illegal_names' ) ); 212 $this->assertEquals( array( 'foo', 'bar' ), get_site_option( 'limited_email_domains' ) ); 213 $this->assertEquals( array( 'foo', 'bar' ), get_site_option( 'banned_email_domains' ) ); 214 215 foreach ( array( 'illegal_names', 'limited_email_domains', 'banned_email_domains' ) as $option ) { 216 update_site_option( $option, array() ); 217 $this->assertSame( '', get_site_option( $option ) ); 218 } 219 } 153 220 } 221 154 222 endif;
Note: See TracChangeset
for help on using the changeset viewer.