From c556e0dbab51d8f02e3d6ae61f08aaa3ab89836f Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Thu, 9 Sep 2021 22:43:49 +0000 Subject: [PATCH] Tests: Add more invalid IP test cases and `@covers` to `Tests_Functions_Anonymization`. Adds a few more invalid IP test cases. Adds extra `@covers` tag for the two functions which are testing the `wp_privacy_anonymize_ip()` function. (At class level, the `wp_privacy_anonymize_data()` is set as covered). Follow-up to [42971]. Props jrf, hellofromTonya. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@51792 602fd350-edb4-49c9-b593-d223f7449a82 --- .../phpunit/tests/functions/anonymization.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/phpunit/tests/functions/anonymization.php b/tests/phpunit/tests/functions/anonymization.php index 9ca33b441e..b0dfafa528 100644 --- a/tests/phpunit/tests/functions/anonymization.php +++ b/tests/phpunit/tests/functions/anonymization.php @@ -26,6 +26,8 @@ class Tests_Functions_Anonymization extends WP_UnitTestCase { * @ticket 41083 * @ticket 43545 * + * @covers ::wp_privacy_anonymize_ip + * * @param string $raw_ip Raw IP address. * @param string $expected_result Expected result. */ @@ -56,6 +58,22 @@ class Tests_Functions_Anonymization extends WP_UnitTestCase { null, '0.0.0.0', ), + array( + false, + '0.0.0.0', + ), + array( + true, + '0.0.0.0', + ), + array( + 0, + '0.0.0.0', + ), + array( + 1, + '0.0.0.0', + ), array( '', '0.0.0.0', @@ -166,6 +184,8 @@ class Tests_Functions_Anonymization extends WP_UnitTestCase { * @requires function inet_ntop * @requires function inet_pton * + * @covers ::wp_privacy_anonymize_ip + * * @param string $raw_ip Raw IP address. * @param string $expected_result Expected result. */