Changeset 30007
- Timestamp:
- 10/24/2014 05:30:14 AM (11 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
r30006 r30007 734 734 } 735 735 736 /** 737 * Test the original and cached responses for a created and then deleted site when 738 * the blog ID is requested through get_blog_id_from_url(). 739 */ 736 740 function test_get_blog_id_from_url() { 737 741 $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); … … 739 743 740 744 $details = get_blog_details( $blog_id, false ); 741 745 $key = md5( $details->domain . $details->path ); 746 747 // Test the original response and cached response for the newly created site. 742 748 $this->assertEquals( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) ); 743 $key = md5( $details->domain . $details->path );744 749 $this->assertEquals( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) ); 745 750 751 // Test the case insensitivity of the site lookup. 752 $this->assertEquals( $blog_id, get_blog_id_from_url( strtoupper( $details->domain ) , strtoupper( $details->path ) ) ); 753 754 // Test the first and cached responses for a non existent site. 746 755 $this->assertEquals( 0, get_blog_id_from_url( $details->domain, 'foo' ) ); 747 756 $this->assertEquals( -1, wp_cache_get( md5( $details->domain . 'foo' ), 'blog-id-cache' ) ); 757 758 // A blog ID is still available if only the 'deleted' flag is set for a site. 748 759 wpmu_delete_blog( $blog_id ); 749 760 $this->assertEquals( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) ); 761 $this->assertEquals( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) ); 762 763 // Explicitly pass $drop = false (default), a blog ID will still be available. 764 wpmu_delete_blog( $blog_id, false ); 765 $this->assertEquals( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) ); 766 $this->assertEquals( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) ); 767 768 // When deleted with the drop parameter at true, the cache will first be false, and then 769 // set to -1 after an attempt at get_blog_id_from_url() is made. 750 770 wpmu_delete_blog( $blog_id, true ); 751 752 771 $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) ); 753 772 $this->assertEquals( 0, get_blog_id_from_url( $details->domain, $details->path ) ); 773 $this->assertEquals( -1, wp_cache_get( $key, 'blog-id-cache' ) ); 754 774 } 755 775
Note: See TracChangeset
for help on using the changeset viewer.