Changeset 44805 for trunk/tests/phpunit/tests/multisite/site.php
- Timestamp:
- 03/07/2019 03:33:25 AM (7 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/multisite/site.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/site.php
r44727 r44805 13 13 protected $site_status_hooks = array(); 14 14 protected $wp_initialize_site_args = array(); 15 protected $wp_initialize_site_meta = array(); 15 16 protected static $network_ids; 16 17 protected static $site_ids; … … 2349 2350 update_option( 'siteurl', 'http://testsite1.example.org/test' ); 2350 2351 } 2352 2353 /** 2354 * Tests whether all expected meta are provided in deprecated `wpmu_new_blog` action. 2355 * 2356 * @dataProvider data_wpmu_new_blog_action_backward_commpatible 2357 * 2358 * @ticket 46351 2359 */ 2360 public function test_wpmu_new_blog_action_backward_compatible( $meta, $expected_meta ) { 2361 // We are testing deprecated hook. Register it to expected deprecated notices. 2362 $this->setExpectedDeprecated( 'wpmu_new_blog' ); 2363 add_action( 'wpmu_new_blog', array( $this, 'wpmu_new_blog_callback' ), 10, 6 ); 2364 2365 wpmu_create_blog( 'testsite1.example.org', '/new-blog/', 'New Blog', get_current_user_id(), $meta, 1 ); 2366 2367 $this->assertEquals( $expected_meta, $this->wp_initialize_site_meta ); 2368 2369 $this->wp_initialize_site_meta = array(); 2370 } 2371 2372 /** 2373 * Capture the $meta value passed to the wpmu_new_blog action and compare it. 2374 */ 2375 public function wpmu_new_blog_callback( $blog_id, $user_id, $domain, $path, $network_id, $meta ) { 2376 $this->wp_initialize_site_meta = $meta; 2377 } 2378 2379 public function data_wpmu_new_blog_action_backward_commpatible() { 2380 return array( 2381 'default values' => array( 2382 array( 2383 ), 2384 array( 2385 'public' => 0, // `public` is one of the defaults metas in `wpmu_create_blog' function prior WordPress 5.1.0 2386 'WPLANG' => 'en_US', // WPLANG is another default meta in `wpmu_create_blog` function prior WordPress 5.1.0. 2387 ), 2388 ), 2389 'public site' => array( 2390 array( 2391 'public' => 1, 2392 ), 2393 array( 2394 'public' => 1, 2395 'WPLANG' => 'en_US' 2396 ), 2397 ), 2398 'all whitelisted' => array( 2399 array( 2400 'public' => -1, 2401 'archived' => 0, 2402 'mature' => 0, 2403 'spam' => 0, 2404 'deleted' => 0, 2405 'lang_id' => 11, 2406 2407 ), 2408 array( 2409 'public' => -1, 2410 'WPLANG' => 'en_US', 2411 'archived' => 0, 2412 'mature' => 0, 2413 'spam' => 0, 2414 'deleted' => 0, 2415 'lang_id' => 11, 2416 ), 2417 ), 2418 'extra meta key' => array( 2419 array( 2420 'foo' => 'bar', 2421 ), 2422 array( 2423 'public' => 0, 2424 'WPLANG' => 'en_US', 2425 'foo' => 'bar', 2426 ), 2427 ), 2428 ); 2429 } 2351 2430 } 2352 2431
Note: See TracChangeset
for help on using the changeset viewer.