Changeset 12496 for trunk/tests/phpunit/testcases/blogs/template.php
- Timestamp:
- 11/11/2019 12:48:27 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/blogs/template.php
r12244 r12496 368 368 } 369 369 370 /** 371 * @group avatar 372 * @group BP_Blogs_Template 373 * @group bp_get_blog_avatar 374 */ 375 public function test_bp_get_blog_avatar_ids_provided() { 376 if ( ! is_multisite() ) { 377 $this->markTestSkipped(); 378 } 379 380 if ( function_exists( 'wp_initialize_site' ) ) { 381 $this->setExpectedDeprecated( 'wpmu_new_blog' ); 382 } 383 384 global $blogs_template; 385 $reset_blogs_template = $blogs_template; 386 $blogs_template = null; 387 388 $u = self::factory()->user->create(); 389 $b = self::factory()->blog->create( array( 390 'title' => 'The Foo Bar Blog', 391 'user_id' => $u, 392 ) ); 393 394 $avatar = bp_get_blog_avatar( array( 395 'type' => 'full', 396 'admin_user_id' => $u, 397 'blog_id' => $b, 398 'alt' => 'test', 399 'no_grav' => true, 400 'class' => 'avatar', 401 ) ); 402 403 $blogs_template = $reset_blogs_template; 404 405 $this->assertTrue( $avatar === bp_core_fetch_avatar( array( 406 'type' => 'full', 407 'item_id' => $u, 408 'alt' => 'test', 409 'no_grav' => true, 410 'class' => 'avatar', 411 ) ) ); 412 } 413 414 /** 415 * @group avatar 416 * @group BP_Blogs_Template 417 * @group bp_get_blog_avatar 418 */ 419 public function test_bp_get_blog_avatar_has_site_icon() { 420 if ( ! is_multisite() ) { 421 $this->markTestSkipped(); 422 } 423 424 if ( function_exists( 'wp_initialize_site' ) ) { 425 $this->setExpectedDeprecated( 'wpmu_new_blog' ); 426 } 427 428 global $blogs_template; 429 $reset_blogs_template = $blogs_template; 430 $blogs_template = null; 431 432 $u = self::factory()->user->create(); 433 $b = self::factory()->blog->create( array( 434 'title' => 'The Bar Foo Blog', 435 'user_id' => $u, 436 ) ); 437 438 add_filter( 'get_site_icon_url', array( $this, 'filter_blog_avatar' ) ); 439 440 $avatar = bp_get_blog_avatar( array( 441 'type' => 'full', 442 'admin_user_id' => $u, 443 'blog_id' => $b, 444 'alt' => 'test', 445 'no_grav' => true, 446 'class' => 'avatar', 447 ) ); 448 449 remove_filter( 'get_site_icon_url', array( $this, 'filter_blog_avatar' ) ); 450 $blogs_template = $reset_blogs_template; 451 452 $this->assertTrue( false !== strpos( $avatar, BP_TESTS_DIR . 'assets/upside-down.jpg' ) ); 453 } 454 455 public function filter_blog_avatar() { 456 return BP_TESTS_DIR . 'assets/upside-down.jpg'; 457 } 370 458 }
Note: See TracChangeset
for help on using the changeset viewer.