Make WordPress Core


Ignore:
Timestamp:
07/10/2021 11:15:44 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertTrue( isset( ... ) ) with assertArrayHasKey() to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367].

See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/oembed/filterResult.php

    r49117 r51397  
    2020        preg_match( '|src=".*#\?secret=([\w\d]+)" data-secret="([\w\d]+)"|', $actual, $matches );
    2121
    22         $this->assertTrue( isset( $matches[1] ) );
    23         $this->assertTrue( isset( $matches[2] ) );
     22        $this->assertArrayHasKey( 1, $matches );
     23        $this->assertArrayHasKey( 2, $matches );
    2424        $this->assertSame( $matches[1], $matches[2] );
    2525    }
     
    6464        preg_match( '|src="https://wordpress.org#\?secret=([\w\d]+)" data-secret="([\w\d]+)"|', $actual, $matches );
    6565
    66         $this->assertTrue( isset( $matches[1] ) );
    67         $this->assertTrue( isset( $matches[2] ) );
     66        $this->assertArrayHasKey( 1, $matches );
     67        $this->assertArrayHasKey( 2, $matches );
    6868        $this->assertSame( $matches[1], $matches[2] );
    6969    }
Note: See TracChangeset for help on using the changeset viewer.