WordPress.org

Make WordPress Core

Changeset 37665


Ignore:
Timestamp:
06/09/2016 05:40:45 AM (4 years ago)
Author:
jeremyfelt
Message:

Tests: Move get_blog_details() tests to their own file

See #36566.

Location:
trunk/tests/phpunit/tests/multisite
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/site.php

    r37660 r37665  
    600600        $details = get_blog_details( get_current_blog_id() );
    601601        $this->assertEquals( 'bar', $details->blogname );
    602     }
    603 
    604     /**
    605      * @ticket 29845
    606      */
    607     function test_get_blog_details() {
    608         $network_ids = array(
    609             'wordpress.org/'         => array( 'domain' => 'wordpress.org', 'path' => '/' ),
    610             'make.wordpress.org/'    => array( 'domain' => 'make.wordpress.org', 'path' => '/' ),
    611         );
    612 
    613         foreach ( $network_ids as &$id ) {
    614             $id = self::factory()->network->create( $id );
    615         }
    616         unset( $id );
    617 
    618         $ids = array(
    619             'wordpress.org/'              => array( 'domain' => 'wordpress.org',      'path' => '/',         'title' => 'Test 1', 'site_id' => $network_ids['wordpress.org/'] ),
    620             'wordpress.org/foo/'          => array( 'domain' => 'wordpress.org',      'path' => '/foo/',     'title' => 'Test 2', 'site_id' => $network_ids['wordpress.org/'] ),
    621             'wordpress.org/foo/bar/'      => array( 'domain' => 'wordpress.org',      'path' => '/foo/bar/', 'title' => 'Test 3', 'site_id' => $network_ids['wordpress.org/'] ),
    622             'make.wordpress.org/'         => array( 'domain' => 'make.wordpress.org', 'path' => '/',         'title' => 'Test 4', 'site_id' => $network_ids['make.wordpress.org/'] ),
    623             'make.wordpress.org/foo/'     => array( 'domain' => 'make.wordpress.org', 'path' => '/foo/',     'title' => 'Test 5', 'site_id' => $network_ids['make.wordpress.org/'] ),
    624         );
    625 
    626         foreach ( $ids as &$id ) {
    627             $id = self::factory()->blog->create( $id );
    628         }
    629         unset( $id );
    630 
    631         // Retrieve site details by passing only a blog ID.
    632         $site = get_blog_details( $ids['wordpress.org/'] );
    633         $this->assertEquals( $ids['wordpress.org/'], $site->blog_id );
    634         $this->assertEquals( 'Test 1', $site->blogname );
    635 
    636         $site = get_blog_details( $ids['wordpress.org/foo/'] );
    637         $this->assertEquals( $ids['wordpress.org/foo/'], $site->blog_id );
    638         $this->assertEquals( 'Test 2', $site->blogname );
    639 
    640         $site = get_blog_details( 999 );
    641         $this->assertFalse( $site );
    642 
    643         // Retrieve site details by passing an array containing blog_id.
    644         $site = get_blog_details( array( 'blog_id' => $ids['wordpress.org/foo/bar/'] ) );
    645         $this->assertEquals( $ids['wordpress.org/foo/bar/'], $site->blog_id );
    646         $this->assertEquals( 'Test 3', $site->blogname );
    647 
    648         $site = get_blog_details( array( 'blog_id' => $ids['make.wordpress.org/'] ) );
    649         $this->assertEquals( $ids['make.wordpress.org/'], $site->blog_id );
    650         $this->assertEquals( 'Test 4', $site->blogname );
    651 
    652         $site = get_blog_details( array( 'blog_id' => 999 ) );
    653         $this->assertFalse( $site );
    654 
    655         // Retrieve site details by passing an array containing domain and path.
    656         $site = get_blog_details( array( 'domain' => 'wordpress.org', 'path' => '/' ) );
    657         $this->assertEquals( $ids['wordpress.org/'], $site->blog_id );
    658         $this->assertEquals( 'Test 1', $site->blogname );
    659 
    660         $site = get_blog_details( array( 'domain' => 'wordpress.org', 'path' => '/foo/' ) );
    661         $this->assertEquals( $ids['wordpress.org/foo/'], $site->blog_id );
    662         $this->assertEquals( 'Test 2', $site->blogname );
    663 
    664         $site = get_blog_details( array( 'domain' => 'wordpress.org', 'path' => '/foo/bar/' ) );
    665         $this->assertEquals( $ids['wordpress.org/foo/bar/'], $site->blog_id );
    666         $this->assertEquals( 'Test 3', $site->blogname );
    667 
    668         $site = get_blog_details( array( 'domain' => 'make.wordpress.org', 'path' => '/' ) );
    669         $this->assertEquals( $ids['make.wordpress.org/'], $site->blog_id );
    670         $this->assertEquals( 'Test 4', $site->blogname );
    671 
    672         $site = get_blog_details( array( 'domain' => 'make.wordpress.org', 'path' => '/foo/' ) );
    673         $this->assertEquals( $ids['make.wordpress.org/foo/'], $site->blog_id );
    674         $this->assertEquals( 'Test 5', $site->blogname );
    675 
    676         $site = get_blog_details( array( 'domain' => 'wordpress.org', 'path' => '/zxy/' ) );
    677         $this->assertFalse( $site );
    678602    }
    679603
Note: See TracChangeset for help on using the changeset viewer.