Tests: Simplify some function calls in Tests_Media.

The remaining assertions using `preg_match_all()` do actually pass a regex, but the third parameter `$matches` is never used.

This third parameter became optional in PHP 5.4, so we may as well remove it.

Reference: [https://www.php.net/manual/en/function.preg-match-all.php PHP Manual: preg_match_all()]

Follow-up to [711/tests], [53558], [53790].

Props jrf.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53795 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-07-29 14:33:15 +00:00
parent 407f31951a
commit 968dde1be6

View File

@ -213,8 +213,8 @@ CAP;
$img_preg = preg_quote( self::IMG_CONTENT );
$content_preg = preg_quote( self::HTML_CONTENT );
$this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
$this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
$this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result ) );
$this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result ) );
}
public function test_new_img_caption_shortcode_new_format_and_linked_image() {
@ -226,8 +226,8 @@ CAP;
$img_preg = preg_quote( $linked_image );
$content_preg = preg_quote( self::HTML_CONTENT );
$this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
$this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
$this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result ) );
$this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result ) );
}
public function test_new_img_caption_shortcode_new_format_and_linked_image_with_newline() {
@ -239,8 +239,8 @@ CAP;
$img_preg = preg_quote( $linked_image );
$content_preg = preg_quote( self::HTML_CONTENT );
$this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
$this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
$this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result ) );
$this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result ) );
}
/**