WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (15 months ago)
Author:
SergeyBiryukov
Message:

Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests.

This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Props johnbillion, jrf, SergeyBiryukov.
See #38266.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/hooks/hasFilter.php

    r46586 r48937  
    1717        $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    1818
    19         $this->assertEquals( $priority, $hook->has_filter( $tag, $callback ) );
     19        $this->assertSame( $priority, $hook->has_filter( $tag, $callback ) );
    2020    }
    2121
     
    3030        $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    3131
    32         $this->assertEquals( $priority, $hook->has_filter( $tag, $callback ) );
     32        $this->assertSame( $priority, $hook->has_filter( $tag, $callback ) );
    3333    }
    3434
     
    4242        $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    4343
    44         $this->assertEquals( $priority, $hook->has_filter( $tag, $callback ) );
     44        $this->assertSame( $priority, $hook->has_filter( $tag, $callback ) );
    4545    }
    4646
Note: See TracChangeset for help on using the changeset viewer.