Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (4 years 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/term/meta.php

    r48844 r48937  
    8888
    8989        $found = get_term_meta( $t, 'foo', true );
    90         $this->assertEquals( 'bar', $found );
     90        $this->assertSame( 'bar', $found );
    9191    }
    9292
     
    495495        $GLOBALS['wp_meta_keys'] = array();
    496496
    497         $this->assertEquals( 'term', $this->last_register_meta_call['object_type'] );
    498         $this->assertEquals( $meta_key, $this->last_register_meta_call['meta_key'] );
    499         $this->assertEquals( $args, $this->last_register_meta_call['args'] );
     497        $this->assertSame( 'term', $this->last_register_meta_call['object_type'] );
     498        $this->assertSame( $meta_key, $this->last_register_meta_call['meta_key'] );
     499        $this->assertSame( $args, $this->last_register_meta_call['args'] );
    500500    }
    501501
Note: See TracChangeset for help on using the changeset viewer.