From 968dde1be62432f853b677b3393489a002cf2174 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 29 Jul 2022 14:33:15 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/media.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index d5a6fc5e13..daf585d548 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -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 ) ); } /**