WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/11/2021 12:41:48 PM (5 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertTrue( empty( ... ) ) with assertEmpty() to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397].

See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php

    r51335 r51403  
    7474
    7575        $this->assertIsArray( $routes, '`get_routes` should return an array.' );
    76         $this->assertTrue( ! empty( $routes ), 'Routes should not be empty.' );
     76        $this->assertNotEmpty( $routes, 'Routes should not be empty.' );
    7777
    7878        $routes = array_filter( array_keys( $routes ), array( $this, 'is_builtin_route' ) );
     
    473473                "HTTP $status from $route[route]: " . json_encode( $data )
    474474            );
    475             $this->assertTrue( ! empty( $data ), $route['name'] . ' route should return data.' );
     475            $this->assertNotEmpty( $data, $route['name'] . ' route should return data.' );
    476476
    477477            $fixture           = $this->normalize_fixture( $data, $route['name'] );
Note: See TracChangeset for help on using the changeset viewer.