369 | | |
370 | | /** |
371 | | * @ticket BP6519 |
372 | | */ |
373 | | public function test_bp_blog_get_avatar_should_respect_title_parameter() { |
374 | | global $blogs_template; |
375 | | |
376 | | if ( isset( $blogs_template ) ) { |
377 | | $_blogs_template = $blogs_template; |
378 | | } |
379 | | |
380 | | $user = $this->factory->user->create_and_get(); |
381 | | |
382 | | $blogs_template = new stdClass; |
383 | | $blogs_template->blog = new stdClass; |
384 | | $blogs_template->blog->blog_id = get_current_blog_id(); |
385 | | $blogs_template->blog->admin_user_id = $user->ID; |
386 | | $blogs_template->blog->admin_user_email = $user->user_email; |
387 | | |
388 | | $actual = bp_get_blog_avatar( array( |
389 | | 'title' => 'Foo', |
390 | | ) ); |
391 | | |
392 | | if ( isset( $_blogs_template ) ) { |
393 | | $blogs_template = $_blogs_template; |
394 | | } else { |
395 | | unset( $blogs_template ); |
396 | | } |
397 | | |
398 | | $this->assertContains( 'title="Foo"', $actual ); |
399 | | } |
400 | | |
401 | | /** |
402 | | * @ticket BP6519 |
403 | | */ |
404 | | public function test_bp_blog_get_avatar_title_attribute_should_default_to_user_displayname() { |
405 | | global $blogs_template; |
406 | | |
407 | | if ( isset( $blogs_template ) ) { |
408 | | $_blogs_template = $blogs_template; |
409 | | } |
410 | | |
411 | | $user = $this->factory->user->create_and_get(); |
412 | | |
413 | | $blogs_template = new stdClass; |
414 | | $blogs_template->blog = new stdClass; |
415 | | $blogs_template->blog->blog_id = get_current_blog_id(); |
416 | | $blogs_template->blog->admin_user_id = $user->ID; |
417 | | $blogs_template->blog->admin_user_email = $user->user_email; |
418 | | |
419 | | $actual = bp_get_blog_avatar(); |
420 | | |
421 | | if ( isset( $_blogs_template ) ) { |
422 | | $blogs_template = $_blogs_template; |
423 | | } else { |
424 | | unset( $blogs_template ); |
425 | | } |
426 | | |
427 | | $this->assertContains( 'title="Profile picture of site author ' . bp_core_get_user_displayname( $user->ID ) . '"', $actual ); |
428 | | } |
429 | | } |