Make WordPress Core

Ticket #30566: fix-notice-with-tests-4.30566.diff

File fix-notice-with-tests-4.30566.diff, 1.7 KB (added by nerrad, 10 years ago)

split tests into two don't create site.

  • src/wp-includes/ms-blogs.php

    diff --git src/wp-includes/ms-blogs.php src/wp-includes/ms-blogs.php
    index e1c70e1..11f9cb1 100644
    function wpmu_update_blogs_date() { 
    3737 */
    3838function get_blogaddress_by_id( $blog_id ) {
    3939        $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details!
    40         return esc_url( 'http://' . $bloginfo->domain . $bloginfo->path );
     40        return isset( $bloginfo->domain ) && isset( $bloginfo->path ) ?  esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ) : '';
    4141}
    4242
    4343/**
  • tests/phpunit/tests/multisite/site.php

    diff --git tests/phpunit/tests/multisite/site.php tests/phpunit/tests/multisite/site.php
    index e894a9a..8708c66 100644
    class Tests_Multisite_Site extends WP_UnitTestCase { 
    332332                $result = update_blog_details( 999, array( 'domain' => 'example.com' ) );
    333333                $this->assertFalse( $result );
    334334        }
    335        
     335
    336336        function test_update_blog_details() {
    337337                $blog_id = $this->factory->blog->create();
    338338
    class Tests_Multisite_Site extends WP_UnitTestCase { 
    13881388
    13891389                remove_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 );
    13901390        }
     1391
     1392
     1393
     1394        /**
     1395         * Tests returning an address for a given valid id.
     1396         */
     1397        function test_get_blogaddress_by_id_with_valid_id() {
     1398                $blogaddress = get_blogaddress_by_id( 1 );
     1399                $this->assertEquals( $blogaddress, 'http://example.org/' );
     1400        }
     1401
     1402
     1403        /**
     1404         * Tests returning the appropriate response for a invalid id given.
     1405         */
     1406        function test_get_blogaddress_by_id_with_invalid_id() {
     1407                $blogaddress = get_blogaddress_by_id( 42 );
     1408                $this->assertEquals( '', $blogaddress );
     1409        }
    13911410}
    13921411
    1393 endif;
    1394  No newline at end of file
     1412endif;