Changeset 42343 for trunk/tests/phpunit/tests/avatar.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/avatar.php
r35242 r42343 23 23 24 24 $args = array( 'size' => 100 ); 25 $url = get_avatar_url( 1, $args );25 $url = get_avatar_url( 1, $args ); 26 26 $this->assertEquals( preg_match( '|\?.*s=100|', $url ), 1 ); 27 27 } … … 35 35 36 36 $args = array( 'default' => 'wavatar' ); 37 $url = get_avatar_url( 1, $args );37 $url = get_avatar_url( 1, $args ); 38 38 $this->assertEquals( preg_match( '|\?.*d=wavatar|', $url ), 1 ); 39 39 40 40 $this->assertEquals( preg_match( '|\?.*f=y|', $url ), 0 ); 41 41 $args = array( 'force_default' => true ); 42 $url = get_avatar_url( 1, $args );42 $url = get_avatar_url( 1, $args ); 43 43 $this->assertEquals( preg_match( '|\?.*f=y|', $url ), 1 ); 44 44 } … … 52 52 53 53 $args = array( 'rating' => 'M' ); 54 $url = get_avatar_url( 1, $args );54 $url = get_avatar_url( 1, $args ); 55 55 $this->assertEquals( preg_match( '|\?.*r=m|', $url ), 1 ); 56 56 } … … 64 64 65 65 $args = array( 'scheme' => 'https' ); 66 $url = get_avatar_url( 1, $args );66 $url = get_avatar_url( 1, $args ); 67 67 $this->assertEquals( preg_match( '|^https://|', $url ), 1 ); 68 68 69 69 $args = array( 'scheme' => 'lolcat' ); 70 $url = get_avatar_url( 1, $args );70 $url = get_avatar_url( 1, $args ); 71 71 $this->assertEquals( preg_match( '|^lolcat://|', $url ), 0 ); 72 72 } … … 89 89 90 90 $post_id = self::factory()->post->create( array( 'post_author' => 1 ) ); 91 $post = get_post( $post_id ); 92 $url2 = get_avatar_url( $post ); 93 $this->assertEquals( $url, $url2 ); 94 95 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1 ) ); 96 $comment = get_comment( $comment_id ); 97 $url2 = get_avatar_url( $comment ); 91 $post = get_post( $post_id ); 92 $url2 = get_avatar_url( $post ); 93 $this->assertEquals( $url, $url2 ); 94 95 $comment_id = self::factory()->comment->create( 96 array( 97 'comment_post_ID' => $post_id, 98 'user_id' => 1, 99 ) 100 ); 101 $comment = get_comment( $comment_id ); 102 $url2 = get_avatar_url( $comment ); 98 103 $this->assertEquals( $url, $url2 ); 99 104 } … … 139 144 $url = get_avatar_url( 1 ); 140 145 141 $post_id = self::factory()->post->create( array( 'post_author' => 1 ) ); 142 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1, 'comment_type' => 'pingback' ) ); 143 $comment = get_comment( $comment_id ); 146 $post_id = self::factory()->post->create( array( 'post_author' => 1 ) ); 147 $comment_id = self::factory()->comment->create( 148 array( 149 'comment_post_ID' => $post_id, 150 'user_id' => 1, 151 'comment_type' => 'pingback', 152 ) 153 ); 154 $comment = get_comment( $comment_id ); 144 155 145 156 $url2 = get_avatar_url( $comment ); … … 164 175 public function test_get_avatar_size() { 165 176 $size = '100'; 166 $img = get_avatar( 1, $size );177 $img = get_avatar( 1, $size ); 167 178 $this->assertEquals( preg_match( "|^<img .*height='$size'.*width='$size'|", $img ), 1 ); 168 179 } … … 176 187 public function test_get_avatar_class() { 177 188 $class = 'first'; 178 $img = get_avatar( 1, 96, '', '', array( 'class' => $class ) );189 $img = get_avatar( 1, 96, '', '', array( 'class' => $class ) ); 179 190 $this->assertEquals( preg_match( "|^<img .*class='[^']*{$class}[^']*'|", $img ), 1 ); 180 191 }
Note: See TracChangeset
for help on using the changeset viewer.