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/term/getTerm.php

    r51331 r51397  
    105105        $term = get_term( $t, 'wptests_tax', ARRAY_A );
    106106        $this->assertIsArray( $term );
    107         $this->assertTrue( isset( $term['term_id'] ) );
     107        $this->assertArrayHasKey( 'term_id', $term );
    108108    }
    109109
     
    112112        $term = get_term( $t, 'wptests_tax', ARRAY_N );
    113113        $this->assertIsArray( $term );
    114         $this->assertFalse( isset( $term['term_id'] ) );
     114        $this->assertArrayNotHasKey( 'term_id', $term );
    115115        foreach ( $term as $k => $v ) {
    116116            $this->assertIsInt( $k );
Note: See TracChangeset for help on using the changeset viewer.