Make WordPress Core

Changeset 1072 in tests for trunk/tests/ms.php


Ignore:
Timestamp:
10/04/2012 12:40:41 PM (13 years ago)
Author:
ryan
Message:

is_main_site() tests. see #WP22090

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/ms.php

    r1060 r1072  
    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' ) );
     
    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
Note: See TracChangeset for help on using the changeset viewer.