mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 18:54:29 +00:00
General: Ensure consistent type for integer properties of a bookmark object.
Previously, these properties could be unexpectedly converted to strings in some contexts. This applies to the following function: * `sanitize_bookmark_field()` and the following properties: * `$bookmark::link_id` * `$bookmark::link_rating` Follow-up to [50935]. See #53235. git-svn-id: https://develop.svn.wordpress.org/trunk@50936 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -340,6 +340,20 @@ class Tests_Bookmark_GetBookmark extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 53235
|
||||
*/
|
||||
public function test_numeric_properties_should_be_cast_to_ints() {
|
||||
$contexts = array( 'raw', 'edit', 'db', 'display', 'attribute', 'js' );
|
||||
|
||||
foreach ( $contexts as $context ) {
|
||||
$bookmark = get_bookmark( self::$bookmark->link_id, OBJECT, $context );
|
||||
|
||||
$this->assertInternalType( 'int', $bookmark->link_id );
|
||||
$this->assertInternalType( 'int', $bookmark->link_rating );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the get_bookmark's function arguments to match the order of the function's signature and
|
||||
* reduce code in the tests.
|
||||
|
||||
Reference in New Issue
Block a user