-
Notifications
You must be signed in to change notification settings - Fork 802
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shortcode: Fix the test-class.gravatar.php tests (#38582)
* Shortcode: Fix the test-class.gravatar.php tests * changelog * Format url by wptexturize
- Loading branch information
1 parent
4a18455
commit 58f6ee2
Showing
2 changed files
with
15 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: other | ||
|
||
Shortcode: Fix the test-class.gravatar.php tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,11 +34,14 @@ public function test_shortcodes_gravatar() { | |
* @since 4.5.0 | ||
*/ | ||
public function test_shortcodes_gravatar_image() { | ||
$content = "[gravatar email='[email protected]' size='48']"; | ||
$email = '[email protected]'; | ||
$size = 48; | ||
$content = "[gravatar email='$email' size='$size']"; | ||
|
||
$shortcode_content = do_shortcode( $content ); | ||
$this->assertStringContainsString( "<img alt='' src='http://2.gravatar.com/avatar/572c3489ea700045927076136a969e27?s=48&d=mm&r=g'", $shortcode_content ); | ||
$this->assertStringContainsString( "class='avatar avatar-48 photo' height='48' width='48'", $shortcode_content ); | ||
$avatar_url = wptexturize( get_avatar_url( $email, array( 'size' => $size ) ) ); | ||
$this->assertStringContainsString( "<img alt='' src='$avatar_url'", $shortcode_content ); | ||
$this->assertStringContainsString( "class='avatar avatar-$size photo' height='$size' width='$size'", $shortcode_content ); | ||
} | ||
|
||
/** | ||
|
@@ -76,8 +79,9 @@ public function test_shortcodes_gravatar_profile() { | |
add_filter( 'pre_http_request', $http_request_filter, 10, 1 ); | ||
|
||
$shortcode_content = do_shortcode( $content ); | ||
$avatar_url = wptexturize( get_avatar_url( $email, array( 'size' => 96 ) ) ); | ||
$this->assertStringContainsString( '<div class="grofile vcard" id="grofile-embed-0">', $shortcode_content ); | ||
$this->assertStringContainsString( '<img src="http://2.gravatar.com/avatar/572c3489ea700045927076136a969e27?s=96&d=mm&r=g" width="96" height="96" class="no-grav gravatar photo"', $shortcode_content ); | ||
$this->assertStringContainsString( "<img src=\"$avatar_url\" width=\"96\" height=\"96\" class=\"no-grav gravatar photo\"", $shortcode_content ); | ||
|
||
remove_filter( 'pre_http_request', $http_request_filter, 10, 1 ); | ||
} | ||
|
@@ -88,6 +92,7 @@ public function test_shortcodes_gravatar_profile() { | |
* @since 4.5.0 | ||
*/ | ||
public function test_shortcodes_gravatar_user_id() { | ||
$email = '[email protected]'; | ||
$user = self::factory()->user->create_and_get( array( 'user_email' => '[email protected]' ) ); | ||
$content = "[gravatar_profile who='$user->ID']"; | ||
wp_set_current_user( $user->ID ); | ||
|
@@ -106,7 +111,8 @@ public function test_shortcodes_gravatar_user_id() { | |
add_filter( 'pre_http_request', $http_request_filter, 10, 1 ); | ||
|
||
$shortcode_content = do_shortcode( $content ); | ||
$this->assertStringContainsString( '<img src="http://2.gravatar.com/avatar/572c3489ea700045927076136a969e27?s=96&d=mm&r=g" width="96" height="96" class="no-grav gravatar photo"', $shortcode_content ); | ||
$avatar_url = wptexturize( get_avatar_url( $email, array( 'size' => 96 ) ) ); | ||
$this->assertStringContainsString( "<img src=\"$avatar_url\" width=\"96\" height=\"96\" class=\"no-grav gravatar photo\"", $shortcode_content ); | ||
|
||
remove_filter( 'pre_http_request', $http_request_filter, 10, 1 ); | ||
} | ||
|