Make WordPress Core


Ignore:
Timestamp:
07/18/2021 02:10:24 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertTrue( ... > 0 ) with assertGreaterThan() to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448], [51449], [51451], [51453].

See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post.php

    r51438 r51454  
    8181                        $id = wp_insert_post( $post );
    8282                        $this->assertIsNumeric( $id );
    83                         $this->assertTrue( $id > 0 );
     83                        $this->assertGreaterThan( 0, $id );
    8484
    8585                        // Fetch the post and make sure it matches.
    … …  
    137137                // dmp( _get_cron_array() );
    138138                $this->assertIsNumeric( $id );
    139                 $this->assertTrue( $id > 0 );
     139                $this->assertGreaterThan( 0, $id );
    140140
    141141                // Fetch the post and make sure it matches.
    … …  
    260260                // dmp( _get_cron_array() );
    261261                $this->assertIsNumeric( $id );
    262                 $this->assertTrue( $id > 0 );
     262                $this->assertGreaterThan( 0, $id );
    263263
    264264                // Fetch the post and make sure it matches.
    … …  
    381381                // dmp( _get_cron_array() );
    382382                $this->assertIsNumeric( $id );
    383                 $this->assertTrue( $id > 0 );
     383                $this->assertGreaterThan( 0, $id );
    384384
    385385                // Fetch the post and make sure it matches.
    … …  
    794794                );
    795795                $insert_post_id = wp_insert_post( $post_data, true, true );
    796                 $this->assertTrue( ( is_int( $insert_post_id ) && $insert_post_id > 0 ) );
     796                $this->assertIsInt( $insert_post_id );
     797                $this->assertGreaterThan( 0, $insert_post_id );
    797798
    798799                $post = get_post( $insert_post_id );
Note: See TracChangeset for help on using the changeset viewer.