Make WordPress Core


Ignore:
Timestamp:
10/02/2026 06:29:08 PM (7 weeks ago)
Author:
lancewillett
Message:

Tests: Document object value comparisons in user tests.

Explain why role and user cache tests retain assertEquals(). These checks compare object values rather than the identity of separately created or cached objects.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/13933

Props huzaifaalmesbah.
See #64895.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/updateUserCaches.php

    r50926 r64065  
    1313                update_user_caches( $raw_userdata );
    1414
     15                // Keep assertEquals() because the objects are intentionally compared by value.
    1516                $this->assertEquals( $raw_userdata, wp_cache_get( $u, 'users' ) );
    1617        }
    … …  
    6667                $cached = wp_cache_get( $u, 'users' );
    6768                $this->assertNotInstanceOf( 'WP_User', $cached );
     69
     70                // Keep assertEquals() because the objects are intentionally compared by value.
    6871                $this->assertEquals( $raw_userdata, $cached );
    6972        }
Note: See TracChangeset for help on using the changeset viewer.