Make WordPress Core

Ticket #22090: 22090-ut.diff

File 22090-ut.diff, 1.3 KB (added by ryan, 12 years ago)
  • tests/ms.php

     
    358358                $this->assertEquals( $current_site->domain, $blog->domain );
    359359                $this->assertEquals( '/', $blog->path );
    360360
     361                // Test defaulting to current blog
     362                $this->assertEquals( $blog, get_blog_details() );
     363
    361364                $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
    362365                $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id, 'path' => '/test_blogname', 'title' => 'Test Title' ) );
    363366                $this->assertInternalType( 'int', $blog_id );
     
    556559                $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) );
    557560                $this->assertEquals( 0, get_blog_id_from_url( $details->domain, $details->path ) );
    558561        }
     562
     563        function test_is_main_site() {
     564                $this->assertTrue( is_main_site() );
     565                $this->assertTrue( is_main_site( get_current_blog_id() ) );
     566
     567                $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     568                $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id ) );
     569
     570                switch_to_blog( $blog_id  );
     571                $this->assertFalse( is_main_site( $blog_id ) );
     572                $this->assertFalse( is_main_site( get_current_blog_id() ) );
     573                $this->assertFalse( is_main_site() );
     574
     575                restore_current_blog();
     576        }
    559577}
    560578
    561579endif;