Skip to content

Commit 948ef7e

Browse files
committed
Tests: Document object-value comparisons in abilities API tests.
Explain why four assertions retain assertEquals(): the expected abilities are separate instances whose properties are compared by value. Developed in: #13903 Props huzaifaalmesbah. See #64895. git-svn-id: https://develop.svn.wordpress.org/trunk@64032 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 01df9c7 commit 948ef7e

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ public function test_register_incorrect_already_registered_ability() {
515515
public function test_register_new_ability() {
516516
$result = $this->registry->register( self::$test_ability_name, self::$test_ability_args );
517517

518+
// Keep assertEquals() because the objects are intentionally compared by value.
518519
$this->assertEquals(
519520
new WP_Ability( self::$test_ability_name, self::$test_ability_args ),
520521
$result

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ public function test_unregister_existing_ability() {
519519

520520
$result = wp_unregister_ability( self::$test_ability_name );
521521

522+
// Keep assertEquals() because the objects are intentionally compared by value.
522523
$this->assertEquals(
523524
new WP_Ability( self::$test_ability_name, self::$test_ability_args ),
524525
$result
@@ -581,6 +582,7 @@ static function ( $instance ) use ( $name, $args ) {
581582

582583
$result = wp_get_ability( $name );
583584

585+
// Keep assertEquals() because the objects are intentionally compared by value.
584586
$this->assertEquals(
585587
new WP_Ability( $name, $args ),
586588
$result,
@@ -699,6 +701,8 @@ public function test_get_all_registered_abilities() {
699701
);
700702

701703
$result = wp_get_abilities();
704+
705+
// Keep assertEquals() because the objects are intentionally compared by value.
702706
$this->assertEquals( $expected, $result );
703707
}
704708
}

0 commit comments

Comments
 (0)