Make WordPress Core


Ignore:
Timestamp:
05/21/2024 10:31:51 AM (21 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in block support 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.

Includes renaming a few test classes per the naming conventions.

Reference: Writing PHP Tests: Naming and Organization.

Follow-up to [53076], [53085], [54497], [56046], [56614], [57246], [57491].

See #60705.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/block-supports/layout.php

    r58170 r58181  
    1111 * @covers ::wp_restore_image_outer_container
    1212 */
    13 class Test_Block_Supports_Layout extends WP_UnitTestCase {
     13class Tests_Block_Supports_Layout extends WP_UnitTestCase {
    1414
    1515    /**
     
    311311    public function test_restore_group_inner_container( $args, $expected_output ) {
    312312        $actual_output = wp_restore_group_inner_container( $args['block_content'], $args['block'] );
    313         $this->assertEquals( $expected_output, $actual_output );
     313        $this->assertSame( $expected_output, $actual_output );
    314314    }
    315315
Note: See TracChangeset for help on using the changeset viewer.