Make WordPress Core


Ignore:
Timestamp:
07/10/2021 11:15:44 AM (5 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/rest-api/rest-server.php

    r51331 r51397  
    11191119                        }
    11201120
    1121                         $this->assertTrue( isset( $headers[ $header ] ), sprintf( 'Header %s is not present in the response.', $header ) );
     1121                        $this->assertArrayHasKey( $header, $headers, sprintf( 'Header %s is not present in the response.', $header ) );
    11221122                        $this->assertSame( $value, $headers[ $header ] );
    11231123                }
    11241124
    11251125                // Last-Modified should be unset as per #WP23021.
    1126                 $this->assertFalse( isset( $headers['Last-Modified'] ), 'Last-Modified should not be sent.' );
     1126                $this->assertArrayNotHasKey( 'Last-Modified', $headers, 'Last-Modified should not be sent.' );
    11271127        }
    11281128
Note: See TracChangeset for help on using the changeset viewer.