Make WordPress Core


Ignore:
Timestamp:
07/15/2026 08:00:44 PM (3 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use more specific assertions instead of assertTrue()/assertFalse().

Replace boolean assertions wrapping other checks with the dedicated PHPUnit assertions:

  • assertContains()/assertNotContains() instead of in_array() or array_search() wrapped in assertTrue()/assertFalse().
  • assertDirectoryExists() instead of assertTrue( is_dir( ... ) ). This clarifies intent and produces more descriptive failure messages.

Props Soean, mukesh27, SergeyBiryukov.
See #64894.

File:
1 edited

Legend:

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

    r60253 r62761  
    896896                $this->assertIsInt( array_search( 'bar', $wp->public_query_vars, true ) );
    897897                $this->assertTrue( unregister_taxonomy( 'foo' ) );
    898                 $this->assertFalse( array_search( 'bar', $wp->public_query_vars, true ) );
     898                $this->assertNotContains( 'bar', $wp->public_query_vars );
    899899        }
    900900
Note: See TracChangeset for help on using the changeset viewer.