From cde9366b3a53e29dee662e1efa2cf124a3ca2cdb Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 13 Jun 2022 15:20:02 +0000 Subject: [PATCH] Tests: Add a unit test for PHP 8.1 deprecation notice in `wp_user_settings()`. 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 --- tests/phpunit/tests/option/wpUserSettings.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/phpunit/tests/option/wpUserSettings.php diff --git a/tests/phpunit/tests/option/wpUserSettings.php b/tests/phpunit/tests/option/wpUserSettings.php new file mode 100644 index 0000000000..44cffc730e --- /dev/null +++ b/tests/phpunit/tests/option/wpUserSettings.php @@ -0,0 +1,36 @@ +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(); + } +}