Make WordPress Core

Changeset 64808


Ignore:
Timestamp:
10/27/2026 05:53:36 PM (42 hours ago)
Author:
lancewillett
Message:

Tests: Use strict inequality in top-level test files.

Use assertNotSame() for scalar and array comparisons in database, post count, rewrite, and widget tests.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/14982

Props shailu25.
See #64895.

Location:
trunk/tests/phpunit/tests
Files:
4 edited

Legend:

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

    r64458 r64808  
    260260                $wpdb->col_meta = $new_meta;
    261261
    262                 $this->assertNotEquals( $col_meta, $new_meta );
     262                $this->assertNotSame( $col_meta, $new_meta );
    263263                $this->assertSame( $col_meta, $wpdb->col_meta );
    264264        }
    … …  
    572572                $stop = $wpdb->timer_stop();
    573573
    574                 $this->assertNotEquals( $wpdb->time_start, $stop );
     574                $this->assertNotSame( $wpdb->time_start, $stop );
    575575                $this->assertGreaterThan( $stop, $wpdb->time_start );
    576576        }
  • trunk/tests/phpunit/tests/post.php

    r64111 r64808  
    280280                $this->assertSame( '1', $after_draft_counts->draft );
    281281                $this->assertSame( '2', $after_draft_counts->publish );
    282                 $this->assertNotEquals( $initial_counts->publish, $after_draft_counts->publish );
     282                $this->assertNotSame( $initial_counts->publish, $after_draft_counts->publish );
    283283        }
    284284
    … …  
    301301                $this->assertSame( '1', $after_trash_counts->trash );
    302302                $this->assertSame( '2', $after_trash_counts->publish );
    303                 $this->assertNotEquals( $initial_counts->publish, $after_trash_counts->publish );
     303                $this->assertNotSame( $initial_counts->publish, $after_trash_counts->publish );
    304304        }
    305305
  • trunk/tests/phpunit/tests/rewrite.php

    r64744 r64808  
    372372
    373373                $this->go_to( $not_a_home_url . 'page' );
    374                 $this->assertNotEquals(
     374                $this->assertNotSame(
    375375                        array(
    376376                                'page'     => '',
  • trunk/tests/phpunit/tests/widgets.php

    r64681 r64808  
    12531253
    12541254                // Sidebar_widgets option was not updated.
    1255                 $this->assertNotEquals( $sidebars_widgets, wp_get_sidebars_widgets() );
     1255                $this->assertNotSame( $sidebars_widgets, wp_get_sidebars_widgets() );
    12561256        }
    12571257
Note: See TracChangeset for help on using the changeset viewer.