Make WordPress Core

Changeset 61364


Ignore:
Timestamp:
12/09/2025 10:02:19 PM (2 weeks ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in some newly introduced 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.

Follow-up to [61032].

See #64324.

Location:
trunk/tests/phpunit/tests/abilities-api
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/abilities-api/wpAbilitiesRegistry.php

    r61130 r61364  
    469469
    470470        $result = $this->registry->get_registered( 'test/two' );
    471         $this->assertEquals( 'test/two', $result->get_name() );
     471        $this->assertSame( 'test/two', $result->get_name() );
    472472    }
    473473
     
    500500
    501501        $result = $this->registry->unregister( 'test/three' );
    502         $this->assertEquals( 'test/three', $result->get_name() );
     502        $this->assertSame( 'test/three', $result->get_name() );
    503503
    504504        $this->assertFalse( $this->registry->is_registered( 'test/three' ) );
  • trunk/tests/phpunit/tests/abilities-api/wpRegisterAbility.php

    r61130 r61364  
    254254            'Execution should fail due to no permissions'
    255255        );
    256         $this->assertEquals( 'ability_invalid_permissions', $actual->get_error_code() );
     256        $this->assertSame( 'ability_invalid_permissions', $actual->get_error_code() );
    257257    }
    258258
Note: See TracChangeset for help on using the changeset viewer.