Changeset 38935
- Timestamp:
- 10/25/2016 11:03:15 PM (9 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-blog.php
r37418 r38935 32 32 33 33 function get_object_by_id( $blog_id ) { 34 return get_ blog_details( $blog_id, false);34 return get_site( $blog_id ); 35 35 } 36 36 } -
trunk/tests/phpunit/tests/multisite/site.php
r38762 r38935 302 302 303 303 // compare the update time with the current time, allow delta < 2 304 $blog = get_ blog_details( $wpdb->blogid );304 $blog = get_site( $wpdb->blogid ); 305 305 $current_time = time(); 306 306 $time_difference = $current_time - strtotime( $blog->last_updated ); … … 369 369 add_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10 ); 370 370 update_blog_status( $blog_id, 'spam', 0 ); 371 $blog = get_ blog_details( $blog_id );371 $blog = get_site( $blog_id ); 372 372 373 373 $this->assertEquals( '0', $blog->spam ); … … 376 376 // The action should fire if the status of 'spam' stays the same. 377 377 update_blog_status( $blog_id, 'spam', 0 ); 378 $blog = get_ blog_details( $blog_id );378 $blog = get_site( $blog_id ); 379 379 380 380 $this->assertEquals( '0', $blog->spam ); … … 392 392 add_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 ); 393 393 update_blog_status( $blog_id, 'spam', 1 ); 394 $blog = get_ blog_details( $blog_id );394 $blog = get_site( $blog_id ); 395 395 396 396 $this->assertEquals( '1', $blog->spam ); … … 399 399 // The action should fire if the status of 'spam' stays the same. 400 400 update_blog_status( $blog_id, 'spam', 1 ); 401 $blog = get_ blog_details( $blog_id );401 $blog = get_site( $blog_id ); 402 402 403 403 $this->assertEquals( '1', $blog->spam ); … … 415 415 add_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 ); 416 416 update_blog_status( $blog_id, 'archived', 1 ); 417 $blog = get_ blog_details( $blog_id );417 $blog = get_site( $blog_id ); 418 418 419 419 $this->assertEquals( '1', $blog->archived ); … … 422 422 // The action should fire if the status of 'archived' stays the same. 423 423 update_blog_status( $blog_id, 'archived', 1 ); 424 $blog = get_ blog_details( $blog_id );424 $blog = get_site( $blog_id ); 425 425 426 426 $this->assertEquals( '1', $blog->archived ); … … 439 439 add_action( 'unarchive_blog', array( $this, '_action_counter_cb' ), 10 ); 440 440 update_blog_status( $blog_id, 'archived', 0 ); 441 $blog = get_ blog_details( $blog_id );441 $blog = get_site( $blog_id ); 442 442 443 443 $this->assertEquals( '0', $blog->archived ); … … 446 446 // The action should fire if the status of 'archived' stays the same. 447 447 update_blog_status( $blog_id, 'archived', 0 ); 448 $blog = get_ blog_details( $blog_id );448 $blog = get_site( $blog_id ); 449 449 $this->assertEquals( '0', $blog->archived ); 450 450 $this->assertEquals( 2, $test_action_counter ); … … 461 461 add_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 ); 462 462 update_blog_status( $blog_id, 'deleted', 1 ); 463 $blog = get_ blog_details( $blog_id );463 $blog = get_site( $blog_id ); 464 464 465 465 $this->assertEquals( '1', $blog->deleted ); … … 468 468 // The action should fire if the status of 'deleted' stays the same. 469 469 update_blog_status( $blog_id, 'deleted', 1 ); 470 $blog = get_ blog_details( $blog_id );470 $blog = get_site( $blog_id ); 471 471 472 472 $this->assertEquals( '1', $blog->deleted ); … … 485 485 add_action( 'make_undelete_blog', array( $this, '_action_counter_cb' ), 10 ); 486 486 update_blog_status( $blog_id, 'deleted', 0 ); 487 $blog = get_ blog_details( $blog_id );487 $blog = get_site( $blog_id ); 488 488 489 489 $this->assertEquals( '0', $blog->deleted ); … … 492 492 // The action should fire if the status of 'deleted' stays the same. 493 493 update_blog_status( $blog_id, 'deleted', 0 ); 494 $blog = get_ blog_details( $blog_id );494 $blog = get_site( $blog_id ); 495 495 496 496 $this->assertEquals( '0', $blog->deleted ); … … 508 508 add_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 ); 509 509 update_blog_status( $blog_id, 'mature', 1 ); 510 $blog = get_ blog_details( $blog_id );510 $blog = get_site( $blog_id ); 511 511 512 512 $this->assertEquals( '1', $blog->mature ); … … 515 515 // The action should fire if the status of 'mature' stays the same. 516 516 update_blog_status( $blog_id, 'mature', 1 ); 517 $blog = get_ blog_details( $blog_id );517 $blog = get_site( $blog_id ); 518 518 519 519 $this->assertEquals( '1', $blog->mature ); … … 533 533 update_blog_status( $blog_id, 'mature', 0 ); 534 534 535 $blog = get_ blog_details( $blog_id );535 $blog = get_site( $blog_id ); 536 536 $this->assertEquals( '0', $blog->mature ); 537 537 $this->assertEquals( 1, $test_action_counter ); … … 539 539 // The action should fire if the status of 'mature' stays the same. 540 540 update_blog_status( $blog_id, 'mature', 0 ); 541 $blog = get_ blog_details( $blog_id );541 $blog = get_site( $blog_id ); 542 542 543 543 $this->assertEquals( '0', $blog->mature ); … … 556 556 update_blog_status( $blog_id, 'public', 0 ); 557 557 558 $blog = get_ blog_details( $blog_id );558 $blog = get_site( $blog_id ); 559 559 $this->assertEquals( '0', $blog->public ); 560 560 $this->assertEquals( 1, $test_action_counter ); … … 562 562 // The action should fire if the status of 'mature' stays the same. 563 563 update_blog_status( $blog_id, 'public', 0 ); 564 $blog = get_ blog_details( $blog_id );564 $blog = get_site( $blog_id ); 565 565 566 566 $this->assertEquals( '0', $blog->public ); … … 576 576 self::factory()->post->create(); 577 577 $post2 = self::factory()->post->create(); 578 $this->assertEquals( 2, get_ blog_details()->post_count );578 $this->assertEquals( 2, get_site()->post_count ); 579 579 580 580 wp_delete_post( $post2 ); 581 $this->assertEquals( 1, get_ blog_details()->post_count );581 $this->assertEquals( 1, get_site()->post_count ); 582 582 } 583 583 … … 587 587 function test_blog_details_cache_invalidation() { 588 588 update_option( 'blogname', 'foo' ); 589 $details = get_ blog_details( get_current_blog_id() );589 $details = get_site( get_current_blog_id() ); 590 590 $this->assertEquals( 'foo', $details->blogname ); 591 591 592 592 update_option( 'blogname', 'bar' ); 593 $details = get_ blog_details( get_current_blog_id() );593 $details = get_site( get_current_blog_id() ); 594 594 $this->assertEquals( 'bar', $details->blogname ); 595 595 } … … 601 601 function test_get_blog_id_from_url() { 602 602 $blog_id = self::factory()->blog->create(); 603 $details = get_ blog_details( $blog_id, false);603 $details = get_site( $blog_id ); 604 604 $key = md5( $details->domain . $details->path ); 605 605 … … 614 614 function test_get_blog_id_from_url_is_case_insensitive() { 615 615 $blog_id = self::factory()->blog->create( array( 'domain' => 'example.com', 'path' => '/xyz' ) ); 616 $details = get_ blog_details( $blog_id, false);616 $details = get_site( $blog_id ); 617 617 618 618 $this->assertEquals( $blog_id, get_blog_id_from_url( strtoupper( $details->domain ), strtoupper( $details->path ) ) ); … … 624 624 function test_get_blog_id_from_url_that_does_not_exist() { 625 625 $blog_id = self::factory()->blog->create( array( 'path' => '/xyz' ) ); 626 $details = get_ blog_details( $blog_id, false);626 $details = get_site( $blog_id ); 627 627 628 628 $this->assertEquals( 0, get_blog_id_from_url( $details->domain, 'foo' ) ); … … 636 636 function test_get_blog_id_from_url_with_deleted_flag() { 637 637 $blog_id = self::factory()->blog->create(); 638 $details = get_ blog_details( $blog_id, false);638 $details = get_site( $blog_id ); 639 639 $key = md5( $details->domain . $details->path ); 640 640 wpmu_delete_blog( $blog_id ); … … 650 650 function test_get_blog_id_from_url_after_dropped() { 651 651 $blog_id = self::factory()->blog->create(); 652 $details = get_ blog_details( $blog_id, false);652 $details = get_site( $blog_id ); 653 653 $key = md5( $details->domain . $details->path ); 654 654 wpmu_delete_blog( $blog_id, true ); … … 767 767 768 768 function test_domain_exists_with_default_site_id() { 769 $details = get_ blog_details( 1, false);769 $details = get_site( 1 ); 770 770 771 771 $this->assertEquals( 1, domain_exists( $details->domain, $details->path ) ); … … 773 773 774 774 function test_domain_exists_with_specified_site_id() { 775 $details = get_ blog_details( 1, false);775 $details = get_site( 1 ); 776 776 777 777 $this->assertEquals( 1, domain_exists( $details->domain, $details->path, $details->site_id ) ); … … 783 783 */ 784 784 function test_domain_does_not_exist_with_invalid_site_id() { 785 $details = get_ blog_details( 1, false);785 $details = get_site( 1 ); 786 786 787 787 $this->assertEquals( null, domain_exists( $details->domain, $details->path, 999 ) ); -
trunk/tests/phpunit/tests/multisite/updateBlogDetails.php
r35242 r38935 32 32 $this->assertTrue( $result ); 33 33 34 $blog = get_ blog_details( $blog_id );34 $blog = get_site( $blog_id ); 35 35 36 36 $this->assertEquals( 'example.com', $blog->domain ); … … 64 64 65 65 update_blog_details( $blog_id, array( $flag => $flag_value ) ); 66 $blog = get_ blog_details( $blog_id );66 $blog = get_site( $blog_id ); 67 67 68 68 $this->assertEquals( $flag_value, $blog->{$flag} ); … … 109 109 public function test_update_blog_details_single_directory_path( $path, $expected ) { 110 110 update_blog_details( 1, array( 'path' => $path ) ); 111 $site = get_ blog_details( 1 );111 $site = get_site( 1 ); 112 112 113 113 $this->assertEquals( $expected, $site->path );
Note: See TracChangeset
for help on using the changeset viewer.