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-post-types-controller.php

    r51367 r51397  
    4444        $this->assertSame( $post_types['page']->name, $data['page']['slug'] );
    4545        $this->check_post_type_obj( 'view', $post_types['page'], $data['page'], $data['page']['_links'] );
    46         $this->assertFalse( isset( $data['revision'] ) );
     46        $this->assertArrayNotHasKey( 'revision', $data );
    4747    }
    4848
     
    219219            $this->assertSame( get_all_post_type_supports( $post_type_obj->name ), $data['supports'] );
    220220        } else {
    221             $this->assertFalse( isset( $data['capabilities'] ) );
    222             $this->assertFalse( isset( $data['viewable'] ) );
    223             $this->assertFalse( isset( $data['labels'] ) );
    224             $this->assertFalse( isset( $data['supports'] ) );
     221            $this->assertArrayNotHasKey( 'capabilities', $data );
     222            $this->assertArrayNotHasKey( 'viewable', $data );
     223            $this->assertArrayNotHasKey( 'labels', $data );
     224            $this->assertArrayNotHasKey( 'supports', $data );
    225225        }
    226226    }
Note: See TracChangeset for help on using the changeset viewer.