Changeset 35242 for trunk/tests/phpunit/tests/multisite/site.php
- Timestamp:
- 10/17/2015 06:02:16 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/site.php
r35225 r35242 35 35 $this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) ); 36 36 37 $blog_id = self:: $factory->blog->create();37 $blog_id = self::factory()->blog->create(); 38 38 39 39 $cap_key = wp_get_current_user()->cap_key; … … 75 75 global $wpdb; 76 76 77 $blog_id = self:: $factory->blog->create();77 $blog_id = self::factory()->blog->create(); 78 78 79 79 $this->assertInternalType( 'int', $blog_id ); … … 131 131 */ 132 132 function test_data_in_cache_after_wpmu_delete_blog_drop_false() { 133 $blog_id = self:: $factory->blog->create();133 $blog_id = self::factory()->blog->create(); 134 134 135 135 $details = get_blog_details( $blog_id, false ); … … 152 152 global $wpdb; 153 153 154 $blog_id = self:: $factory->blog->create();154 $blog_id = self::factory()->blog->create(); 155 155 156 156 // Delete the site without forcing a table drop. … … 170 170 */ 171 171 function test_data_in_cache_after_wpmu_delete_blog_drop_true() { 172 $blog_id = self:: $factory->blog->create();172 $blog_id = self::factory()->blog->create(); 173 173 174 174 $details = get_blog_details( $blog_id, false ); … … 191 191 global $wpdb; 192 192 193 $blog_id = self:: $factory->blog->create();193 $blog_id = self::factory()->blog->create(); 194 194 195 195 // Delete the site and force a table drop. … … 248 248 */ 249 249 function test_network_count_after_wpmu_delete_blog_drop_false() { 250 $blog_id = self:: $factory->blog->create();250 $blog_id = self::factory()->blog->create(); 251 251 252 252 // Delete the site without forcing a table drop. … … 262 262 */ 263 263 function test_blog_count_after_wpmu_delete_blog_drop_true() { 264 $blog_id = self:: $factory->blog->create();264 $blog_id = self::factory()->blog->create(); 265 265 266 266 // Delete the site and force a table drop. … … 284 284 $file1 = wp_upload_bits( $filename, null, $contents ); 285 285 286 $blog_id = self:: $factory->blog->create();286 $blog_id = self::factory()->blog->create(); 287 287 288 288 switch_to_blog( $blog_id ); … … 330 330 function test_get_blog_details_when_site_does_not_exist() { 331 331 // Create an unused site so that we can then assume an invalid site ID. 332 $blog_id = self:: $factory->blog->create();332 $blog_id = self::factory()->blog->create(); 333 333 $blog_id++; 334 334 … … 340 340 341 341 // Create a site in the invalid site's place. 342 self:: $factory->blog->create();342 self::factory()->blog->create(); 343 343 344 344 // When a new site is created, its cache is cleared through refresh_blog_details. … … 371 371 $test_action_counter = 0; 372 372 373 $blog_id = self:: $factory->blog->create();373 $blog_id = self::factory()->blog->create(); 374 374 update_blog_details( $blog_id, array( 'spam' => 1 ) ); 375 375 … … 395 395 $test_action_counter = 0; 396 396 397 $blog_id = self:: $factory->blog->create();397 $blog_id = self::factory()->blog->create(); 398 398 399 399 add_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 ); … … 418 418 $test_action_counter = 0; 419 419 420 $blog_id = self:: $factory->blog->create();420 $blog_id = self::factory()->blog->create(); 421 421 422 422 add_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 ); … … 441 441 $test_action_counter = 0; 442 442 443 $blog_id = self:: $factory->blog->create();443 $blog_id = self::factory()->blog->create(); 444 444 update_blog_details( $blog_id, array( 'archived' => 1 ) ); 445 445 … … 464 464 $test_action_counter = 0; 465 465 466 $blog_id = self:: $factory->blog->create();466 $blog_id = self::factory()->blog->create(); 467 467 468 468 add_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 ); … … 487 487 $test_action_counter = 0; 488 488 489 $blog_id = self:: $factory->blog->create();489 $blog_id = self::factory()->blog->create(); 490 490 update_blog_details( $blog_id, array( 'deleted' => 1 ) ); 491 491 … … 511 511 $test_action_counter = 0; 512 512 513 $blog_id = self:: $factory->blog->create();513 $blog_id = self::factory()->blog->create(); 514 514 515 515 add_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 ); … … 534 534 $test_action_counter = 0; 535 535 536 $blog_id = self:: $factory->blog->create();536 $blog_id = self::factory()->blog->create(); 537 537 update_blog_details( $blog_id, array( 'mature' => 1 ) ); 538 538 … … 558 558 $test_action_counter = 0; 559 559 560 $blog_id = self:: $factory->blog->create();560 $blog_id = self::factory()->blog->create(); 561 561 562 562 add_action( 'update_blog_public', array( $this, '_action_counter_cb' ), 10 ); … … 584 584 */ 585 585 function test_wp_get_sites_with_default_arguments() { 586 self:: $factory->blog->create( array( 'site_id' => 2 ) );586 self::factory()->blog->create( array( 'site_id' => 2 ) ); 587 587 588 588 $this->assertCount( 1, wp_get_sites() ); … … 600 600 */ 601 601 function test_wp_get_sites_with_network_id_null() { 602 self:: $factory->blog->create( array( 'site_id' => 2 ) );602 self::factory()->blog->create( array( 'site_id' => 2 ) ); 603 603 604 604 $this->assertCount( 2, wp_get_sites( array( 'network_id' => null ) ) ); … … 609 609 */ 610 610 function test_wp_get_sites_with_specific_network_id() { 611 self:: $factory->blog->create( array( 'site_id' => 2 ) );611 self::factory()->blog->create( array( 'site_id' => 2 ) ); 612 612 613 613 $this->assertCount( 1, wp_get_sites( array( 'network_id' => 2 ) ) ); … … 618 618 */ 619 619 function test_wp_get_sites_with_multiple_network_ids() { 620 self:: $factory->blog->create( array( 'site_id' => 2 ) );620 self::factory()->blog->create( array( 'site_id' => 2 ) ); 621 621 622 622 $this->assertCount( 2, wp_get_sites( array( 'network_id' => array( 1, 2 ) ) ) ); … … 627 627 */ 628 628 function test_wp_get_sites_with_public_meta_on_all_networks() { 629 self:: $factory->blog->create( array( 'site_id' => 2, 'meta' => array( 'public' => 0 ) ) );629 self::factory()->blog->create( array( 'site_id' => 2, 'meta' => array( 'public' => 0 ) ) ); 630 630 631 631 $this->assertCount( 1, wp_get_sites( array( 'public' => 1, 'network_id' => null ) ) ); … … 637 637 */ 638 638 function test_wp_get_sites_with_public_meta_restrict_to_one_network() { 639 self:: $factory->blog->create( array( 'site_id' => 1, 'meta' => array( 'public' => 0 ) ) );639 self::factory()->blog->create( array( 'site_id' => 1, 'meta' => array( 'public' => 0 ) ) ); 640 640 641 641 $this->assertCount( 1, wp_get_sites( array( 'public' => 1, 'network_id' => 1 ) ) ); … … 648 648 function test_wp_get_sites_limit_offset() { 649 649 // Create 2 more sites (in addition to the default one) 650 self:: $factory->blog->create_many( 2 );650 self::factory()->blog->create_many( 2 ); 651 651 652 652 // Expect first 2 sites when using limit … … 671 671 */ 672 672 function test_posts_count() { 673 self:: $factory->post->create();674 $post2 = self:: $factory->post->create();673 self::factory()->post->create(); 674 $post2 = self::factory()->post->create(); 675 675 $this->assertEquals( 2, get_blog_details()->post_count ); 676 676 … … 702 702 703 703 foreach ( $network_ids as &$id ) { 704 $id = self:: $factory->network->create( $id );704 $id = self::factory()->network->create( $id ); 705 705 } 706 706 unset( $id ); … … 715 715 716 716 foreach ( $ids as &$id ) { 717 $id = self:: $factory->blog->create( $id );717 $id = self::factory()->blog->create( $id ); 718 718 } 719 719 unset( $id ); … … 773 773 */ 774 774 function test_get_blog_id_from_url() { 775 $blog_id = self:: $factory->blog->create();775 $blog_id = self::factory()->blog->create(); 776 776 $details = get_blog_details( $blog_id, false ); 777 777 $key = md5( $details->domain . $details->path ); … … 786 786 */ 787 787 function test_get_blog_id_from_url_is_case_insensitive() { 788 $blog_id = self:: $factory->blog->create( array( 'domain' => 'example.com', 'path' => '/xyz' ) );788 $blog_id = self::factory()->blog->create( array( 'domain' => 'example.com', 'path' => '/xyz' ) ); 789 789 $details = get_blog_details( $blog_id, false ); 790 790 … … 796 796 */ 797 797 function test_get_blog_id_from_url_that_does_not_exist() { 798 $blog_id = self:: $factory->blog->create( array( 'path' => '/xyz' ) );798 $blog_id = self::factory()->blog->create( array( 'path' => '/xyz' ) ); 799 799 $details = get_blog_details( $blog_id, false ); 800 800 … … 808 808 */ 809 809 function test_get_blog_id_from_url_with_deleted_flag() { 810 $blog_id = self:: $factory->blog->create();810 $blog_id = self::factory()->blog->create(); 811 811 $details = get_blog_details( $blog_id, false ); 812 812 $key = md5( $details->domain . $details->path ); … … 822 822 */ 823 823 function test_get_blog_id_from_url_after_dropped() { 824 $blog_id = self:: $factory->blog->create();824 $blog_id = self::factory()->blog->create(); 825 825 $details = get_blog_details( $blog_id, false ); 826 826 $key = md5( $details->domain . $details->path ); … … 851 851 */ 852 852 function test_is_main_site_is_false_with_other_blog_id() { 853 $blog_id = self:: $factory->blog->create();853 $blog_id = self::factory()->blog->create(); 854 854 855 855 $this->assertFalse( is_main_site( $blog_id ) ); … … 860 860 */ 861 861 function test_is_main_site_is_false_after_switch_to_blog() { 862 $blog_id = self:: $factory->blog->create();862 $blog_id = self::factory()->blog->create(); 863 863 switch_to_blog( $blog_id ); 864 864 … … 879 879 $this->assertEquals( '', $info['error'] ); 880 880 881 $blog_id = self:: $factory->blog->create();881 $blog_id = self::factory()->blog->create(); 882 882 883 883 switch_to_blog( $blog_id ); … … 901 901 */ 902 902 function test_get_blog_post_from_another_site_on_network() { 903 $blog_id = self:: $factory->blog->create();904 $post_id = self:: $factory->post->create(); // Create a post on the primary site, ID 1.903 $blog_id = self::factory()->blog->create(); 904 $post_id = self::factory()->post->create(); // Create a post on the primary site, ID 1. 905 905 $post = get_post( $post_id ); 906 906 switch_to_blog( $blog_id ); … … 916 916 */ 917 917 function test_get_blog_post_from_same_site() { 918 $post_id = self:: $factory->post->create();918 $post_id = self::factory()->post->create(); 919 919 920 920 $this->assertEquals( get_blog_post( 1, $post_id ), get_post( $post_id ) );
Note: See TracChangeset
for help on using the changeset viewer.