Make WordPress Core


Ignore:
Timestamp:
07/29/2022 02:33:15 PM (3 years ago)
Author:
SergeyBiryukov
Message:

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: PHP Manual: preg_match_all()

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

Props jrf.
See #55652.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r53790 r53795  
    214214        $content_preg = preg_quote( self::HTML_CONTENT );
    215215
    216         $this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
    217         $this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
     216        $this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result ) );
     217        $this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result ) );
    218218    }
    219219
     
    227227        $content_preg = preg_quote( self::HTML_CONTENT );
    228228
    229         $this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
    230         $this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
     229        $this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result ) );
     230        $this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result ) );
    231231    }
    232232
     
    240240        $content_preg = preg_quote( self::HTML_CONTENT );
    241241
    242         $this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
    243         $this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
     242        $this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result ) );
     243        $this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result ) );
    244244    }
    245245
Note: See TracChangeset for help on using the changeset viewer.