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/serialization.php

    r46997 r48937  
    2626        $expected = $original;
    2727
    28         $this->assertEquals( $expected, $actual );
     28        $this->assertSame( $expected, $actual );
    2929    }
    3030
     
    5252
    5353    function test_serialized_block_name() {
    54         $this->assertEquals( null, strip_core_block_namespace( null ) );
    55         $this->assertEquals( 'example', strip_core_block_namespace( 'example' ) );
    56         $this->assertEquals( 'example', strip_core_block_namespace( 'core/example' ) );
    57         $this->assertEquals( 'plugin/example', strip_core_block_namespace( 'plugin/example' ) );
     54        $this->assertNull( strip_core_block_namespace( null ) );
     55        $this->assertSame( 'example', strip_core_block_namespace( 'example' ) );
     56        $this->assertSame( 'example', strip_core_block_namespace( 'core/example' ) );
     57        $this->assertSame( 'plugin/example', strip_core_block_namespace( 'plugin/example' ) );
    5858    }
    5959
Note: See TracChangeset for help on using the changeset viewer.