Changeset 53790 for trunk/tests/phpunit/tests/media.php
- Timestamp:
- 07/28/2022 10:37:00 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r53751 r53790 158 158 ); 159 159 160 $this->assertSame( 2, preg_match_all( '/wp-caption/', $result, $_r) );161 $this->assertSame( 1, preg_match_all( '/alignnone/', $result, $_r) );162 $this->assertSame( 1, preg_match_all( '/' . self::CAPTION . '/', $result, $_r) );160 $this->assertSame( 2, substr_count( $result, 'wp-caption' ) ); 161 $this->assertSame( 1, substr_count( $result, 'alignnone' ) ); 162 $this->assertSame( 1, substr_count( $result, self::CAPTION ) ); 163 163 164 164 if ( current_theme_supports( 'html5', 'caption' ) ) { 165 $this->assertSame( 1, preg_match_all( '/width: 20/', $result, $_r) );165 $this->assertSame( 1, substr_count( $result, 'width: 20' ) ); 166 166 } else { 167 $this->assertSame( 1, preg_match_all( '/width: 30/', $result, $_r) );167 $this->assertSame( 1, substr_count( $result, 'width: 30' ) ); 168 168 } 169 169 } … … 178 178 ) 179 179 ); 180 $this->assertSame( 1, preg_match_all( '/wp-caption &myAlignment/', $result, $_r) );181 $this->assertSame( 1, preg_match_all( '/id="myId"/', $result, $_r) );182 $this->assertSame( 1, preg_match_all( '/' . self::CAPTION . '/', $result, $_r) );180 $this->assertSame( 1, substr_count( $result, 'wp-caption &myAlignment' ) ); 181 $this->assertSame( 1, substr_count( $result, 'id="myId"' ) ); 182 $this->assertSame( 1, substr_count( $result, self::CAPTION ) ); 183 183 } 184 184 … … 191 191 ) 192 192 ); 193 $this->assertSame( 1, preg_match_all( '/wp-caption alignnone some-class another-class/', $result, $_r) );193 $this->assertSame( 1, substr_count( $result, 'wp-caption alignnone some-class another-class' ) ); 194 194 195 195 } 196 196 197 197 public function test_new_img_caption_shortcode_with_html_caption() { 198 $result 198 $result = img_caption_shortcode( 199 199 array( 200 200 'width' => 20, … … 202 202 ) 203 203 ); 204 $our_preg = preg_quote( self::HTML_CONTENT ); 205 206 $this->assertSame( 1, preg_match_all( "~{$our_preg}~", $result, $_r ) ); 204 205 $this->assertSame( 1, substr_count( $result, self::HTML_CONTENT ) ); 207 206 } 208 207 … … 257 256 ); 258 257 259 $this->assertSame( 1, preg_match_all( '/aria-describedby="caption-myId"/', $result, $_r) );258 $this->assertSame( 1, substr_count( $result, 'aria-describedby="caption-myId"' ) ); 260 259 } 261 260
Note: See TracChangeset
for help on using the changeset viewer.