forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwpUserSettings.php
More file actions
36 lines (32 loc) · 1.1 KB
/
Copy pathwpUserSettings.php
File metadata and controls
36 lines (32 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?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();
}
}