Make WordPress Core


Ignore:
Timestamp:
07/12/2021 10:35:44 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertTrue( in_array( ... ) ) with assertContains() to use native PHPUnit functionality.

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

Props hellofromTonya, jrf, SergeyBiryukov.
Fixes #53123. See #53363.

File:
1 edited

Legend:

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

    r51367 r51404  
    2323
    2424        $this->assertCount( $public_qv_count + 2, $this->wp->public_query_vars );
    25         $this->assertTrue( in_array( 'test', $this->wp->public_query_vars, true ) );
    26         $this->assertTrue( in_array( 'test2', $this->wp->public_query_vars, true ) );
     25        $this->assertContains( 'test', $this->wp->public_query_vars );
     26        $this->assertContains( 'test2', $this->wp->public_query_vars );
    2727    }
    2828
     
    3131
    3232        $this->wp->add_query_var( 'test' );
    33         $this->assertTrue( in_array( 'test', $this->wp->public_query_vars, true ) );
     33        $this->assertContains( 'test', $this->wp->public_query_vars );
    3434        $this->wp->remove_query_var( 'test' );
    3535
Note: See TracChangeset for help on using the changeset viewer.