Skip to content

Commit f718ba2

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@61364 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0edc4c6 commit f718ba2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/phpunit/tests/abilities-api/wpAbilitiesRegistry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ public function test_get_registered_for_known_ability() {
468468
$this->registry->register( 'test/three', self::$test_ability_args );
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

474474
/**
@@ -499,7 +499,7 @@ public function test_unregister_for_known_ability() {
499499
$this->registry->register( 'test/three', self::$test_ability_args );
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' ) );
505505
}

tests/phpunit/tests/abilities-api/wpRegisterAbility.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public function test_register_ability_no_permissions(): void {
253253
$actual,
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

259259
/**

0 commit comments

Comments
 (0)