diff --git src/wp-includes/ms-blogs.php src/wp-includes/ms-blogs.php
index e1c70e1..11f9cb1 100644
|
|
|
function wpmu_update_blogs_date() { |
| 37 | 37 | */ |
| 38 | 38 | function get_blogaddress_by_id( $blog_id ) { |
| 39 | 39 | $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 ) : ''; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
diff --git tests/phpunit/tests/multisite/site.php tests/phpunit/tests/multisite/site.php
index 3dafbee..b12f8b2 100644
|
|
|
class Tests_Multisite_Site extends WP_UnitTestCase { |
| 877 | 877 | $this->assertFalse( $site ); |
| 878 | 878 | } |
| 879 | 879 | |
| | 880 | |
| | 881 | /** |
| | 882 | * Tests returning an address for both invalid and valid ids and that the appropriate responses occur. |
| | 883 | * |
| | 884 | */ |
| | 885 | function test_get_blogaddress_by_id() { |
| | 886 | $user_id = $this->factory->user->create( array( 'roler' => 'administrator' ) ); |
| | 887 | $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id, 'path' => '/testdomainexists', 'title' => 'Test Title' ) ); |
| | 888 | |
| | 889 | // Test valid id. |
| | 890 | $blogaddress = get_blogaddress_by_id( $blog_id ); |
| | 891 | $this->assertEquals( $blogaddress, 'http://example.org/testdomainexists/' ); |
| | 892 | |
| | 893 | //Test invalid id. |
| | 894 | $invalidblogaddress = get_blogaddress_by_id( 999 ); |
| | 895 | $this->assertEquals( $invalidblogaddress, '' ); |
| | 896 | } |
| | 897 | |
| | 898 | |
| | 899 | |
| 880 | 900 | /** |
| 881 | 901 | * Test the original and cached responses for a created and then deleted site when |
| 882 | 902 | * the blog ID is requested through get_blog_id_from_url(). |
| … |
… |
class Tests_Multisite_Site extends WP_UnitTestCase { |
| 1121 | 1141 | } |
| 1122 | 1142 | } |
| 1123 | 1143 | |
| 1124 | | endif; |
| 1125 | | No newline at end of file |
| | 1144 | endif; |