WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/18/2021 02:10:24 PM (2 months 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/cron.php

    r50610 r51454  
    127127
    128128        // Make sure they're returned by wp_next_scheduled().
    129         $this->assertTrue( wp_next_scheduled( $hook ) > 0 );
    130         $this->assertTrue( wp_next_scheduled( $hook, $args ) > 0 );
     129        $this->assertGreaterThan( 0, wp_next_scheduled( $hook ) );
     130        $this->assertGreaterThan( 0, wp_next_scheduled( $hook, $args ) );
    131131
    132132        // Clear the schedule for the no args events and make sure it's gone.
     
    135135        $this->assertFalse( wp_next_scheduled( $hook ) );
    136136        // The args events should still be there.
    137         $this->assertTrue( wp_next_scheduled( $hook, $args ) > 0 );
     137        $this->assertGreaterThan( 0, wp_next_scheduled( $hook, $args ) );
    138138
    139139        // Clear the schedule for the args events and make sure they're gone too.
     
    166166
    167167        // Make sure they're returned by wp_next_scheduled().
    168         $this->assertTrue( wp_next_scheduled( $hook ) > 0 );
    169         $this->assertTrue( wp_next_scheduled( $hook, $args ) > 0 );
     168        $this->assertGreaterThan( 0, wp_next_scheduled( $hook ) );
     169        $this->assertGreaterThan( 0, wp_next_scheduled( $hook, $args ) );
    170170
    171171        // Clear the schedule for the no args events and make sure it's gone.
     
    173173        $this->assertFalse( wp_next_scheduled( $hook ) );
    174174        // The args events should still be there.
    175         $this->assertTrue( wp_next_scheduled( $hook, $args ) > 0 );
     175        $this->assertGreaterThan( 0, wp_next_scheduled( $hook, $args ) );
    176176
    177177        // Clear the schedule for the args events and make sure they're gone too.
     
    199199
    200200        // Make sure they're returned by wp_next_scheduled().
    201         $this->assertTrue( wp_next_scheduled( $hook ) > 0 );
    202         $this->assertTrue( wp_next_scheduled( $hook, $args ) > 0 );
     201        $this->assertGreaterThan( 0, wp_next_scheduled( $hook ) );
     202        $this->assertGreaterThan( 0, wp_next_scheduled( $hook, $args ) );
    203203
    204204        // Clear the schedule for the no args events and make sure it's gone.
     
    206206        $this->assertFalse( wp_next_scheduled( $hook ) );
    207207        // The args events should still be there.
    208         $this->assertTrue( wp_next_scheduled( $hook, $args ) > 0 );
     208        $this->assertGreaterThan( 0, wp_next_scheduled( $hook, $args ) );
    209209
    210210        // Clear the schedule for the args events and make sure they're gone too.
     
    233233
    234234        // Make sure they're returned by wp_next_scheduled().
    235         $this->assertTrue( wp_next_scheduled( $hook ) > 0 );
    236         $this->assertTrue( wp_next_scheduled( $hook, $args ) > 0 );
     235        $this->assertGreaterThan( 0, wp_next_scheduled( $hook ) );
     236        $this->assertGreaterThan( 0, wp_next_scheduled( $hook, $args ) );
    237237
    238238        // Clear the schedule and make sure it's gone.
Note: See TracChangeset for help on using the changeset viewer.