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/rest-api/rest-tags-controller.php

    r51367 r51397  
    701701
    702702        $meta = (array) $data['meta'];
    703         $this->assertFalse( isset( $meta['test_cat_meta'] ) );
     703        $this->assertArrayNotHasKey( 'test_cat_meta', $meta );
    704704    }
    705705
     
    875875        $this->assertSame( 'just meta', $data['meta']['test_single'] );
    876876        $this->assertSame( 'tag-specific meta', $data['meta']['test_tag_single'] );
    877         $this->assertFalse( isset( $data['meta']['test_cat_meta'] ) );
     877        $this->assertArrayNotHasKey( 'test_cat_meta', $data['meta'] );
    878878    }
    879879
     
    12431243        $properties = $data['schema']['properties'];
    12441244        $this->assertArrayHasKey( 'id', $properties );
    1245         $this->assertFalse( isset( $properties['parent'] ) );
     1245        $this->assertArrayNotHasKey( 'parent', $properties );
    12461246    }
    12471247
     
    14281428            $this->assertSame( $term->parent, $data['parent'] );
    14291429        } else {
    1430             $this->assertFalse( isset( $data['parent'] ) );
     1430            $this->assertArrayNotHasKey( 'parent', $data );
    14311431        }
    14321432        $expected_links = array(
Note: See TracChangeset for help on using the changeset viewer.