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 e894a9a..8708c66 100644
|
|
|
class Tests_Multisite_Site extends WP_UnitTestCase { |
| 332 | 332 | $result = update_blog_details( 999, array( 'domain' => 'example.com' ) ); |
| 333 | 333 | $this->assertFalse( $result ); |
| 334 | 334 | } |
| 335 | | |
| | 335 | |
| 336 | 336 | function test_update_blog_details() { |
| 337 | 337 | $blog_id = $this->factory->blog->create(); |
| 338 | 338 | |
| … |
… |
class Tests_Multisite_Site extends WP_UnitTestCase { |
| 1388 | 1388 | |
| 1389 | 1389 | remove_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 ); |
| 1390 | 1390 | } |
| | 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 | } |
| 1391 | 1410 | } |
| 1392 | 1411 | |
| 1393 | | endif; |
| 1394 | | No newline at end of file |
| | 1412 | endif; |