Make WordPress Core


Ignore:
Timestamp:
07/10/2021 11:15:44 AM (2 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-categories-controller.php

    r51367 r51397  
    748748
    749749        $meta = (array) $data['meta'];
    750         $this->assertFalse( isset( $meta['test_tag_meta'] ) );
     750        $this->assertArrayNotHasKey( 'test_tag_meta', $meta );
    751751    }
    752752
     
    943943        $this->assertSame( 'just meta', $data['meta']['test_single'] );
    944944        $this->assertSame( 'category-specific meta', $data['meta']['test_cat_single'] );
    945         $this->assertFalse( isset( $data['meta']['test_tag_meta'] ) );
     945        $this->assertArrayNotHasKey( 'test_tag_meta', $data['meta'] );
    946946    }
    947947
     
    12101210            $this->assertSame( $term->parent, $data['parent'] );
    12111211        } else {
    1212             $this->assertFalse( isset( $term->parent ) );
     1212            $this->assertObjectNotHasProperty( 'parent', $term );
    12131213        }
    12141214
Note: See TracChangeset for help on using the changeset viewer.