Skip to content

Commit

Permalink
Tests: Add more invalid IP test cases and @covers to `Tests_Functio…
Browse files Browse the repository at this point in the history
…ns_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
  • Loading branch information
hellofromtonya committed Sep 9, 2021
1 parent 1d0e444 commit c556e0d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/phpunit/tests/functions/anonymization.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -56,6 +58,22 @@ public function data_wp_privacy_anonymize_ip() {
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',
Expand Down Expand Up @@ -166,6 +184,8 @@ public function data_wp_privacy_anonymize_ip() {
* @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.
*/
Expand Down

0 comments on commit c556e0d

Please sign in to comment.