mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
This ensures that PHP 8.1 "passing null to non-nullable" deprecation notice is not thrown for the `$domain` parameter of `setcookie()` calls in the function. Follow-up to [53490]. See #54914. git-svn-id: https://develop.svn.wordpress.org/trunk@53493 602fd350-edb4-49c9-b593-d223f7449a82
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Test wp_user_settings().
|
|
*
|
|
* @group option
|
|
* @group user
|
|
* @covers ::wp_user_settings
|
|
*/
|
|
class Tests_Option_wpUserSettings extends WP_UnitTestCase {
|
|
|
|
/**
|
|
* Tests that PHP 8.1 "passing null to non-nullable" deprecation notice
|
|
* is not thrown for the `$domain` parameter of setcookie() calls in the function.
|
|
*
|
|
* The notice that we should not see:
|
|
* `Deprecated: setcookie(): Passing null to parameter #5 ($domain) of type string is deprecated`.
|
|
*
|
|
* Note: This does not test the actual functioning of wp_user_settings().
|
|
* It just and only tests for/against the deprecation notice.
|
|
*
|
|
* @ticket 54914
|
|
*/
|
|
public function test_wp_user_settings_does_not_throw_deprecation_notice_for_setcookie() {
|
|
set_current_screen( 'edit.php' );
|
|
wp_set_current_user( self::factory()->user->create() );
|
|
|
|
// Verify that the function's starting conditions are satisfied.
|
|
$this->assertTrue( is_admin() );
|
|
$this->assertGreaterThan( 0, get_current_user_id() );
|
|
|
|
// `Cannot modify header information - headers already sent by...` from setcookie().
|
|
$this->expectWarning();
|
|
|
|
wp_user_settings();
|
|
}
|
|
}
|