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/blocks/block-context.php

    r48845 r48937  
    132132        render_block( $parsed_blocks[0] );
    133133
    134         $this->assertEquals(
     134        $this->assertSame(
    135135            array(
    136136                'gutenberg/contextWithDefault'  => 0,
     
    168168        render_block( $parsed_blocks[0] );
    169169
    170         $this->assertEquals(
     170        $this->assertSame(
    171171            array(
    172172                'postId'   => $post->ID,
     
    210210        remove_filter( 'render_block_context', $filter_block_context );
    211211
    212         $this->assertEquals( array( 'example' => 'ok' ), $provided_context[0] );
     212        $this->assertSame( array( 'example' => 'ok' ), $provided_context[0] );
    213213    }
    214214
Note: See TracChangeset for help on using the changeset viewer.