Skip to content

Commit

Permalink
Rewrite UnitTestsBootstrap::set_server_props to avoid needing to sk…
Browse files Browse the repository at this point in the history
…ip phpcs checks.

Address: #446 (comment)
  • Loading branch information
eason9487 committed Jul 1, 2024
1 parent 11df3a9 commit db107f7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/class-unittestsbootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ public function set_path_props() {
* Set server props
*/
public function set_server_props() {
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$_SERVER['REMOTE_ADDR'] = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : '';
$_SERVER['SERVER_NAME'] = isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : 'ga_integration_test';
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
if ( ! isset( $_SERVER['REMOTE_ADDR'] ) ) {
$_SERVER['REMOTE_ADDR'] = '';
}
if ( ! isset( $_SERVER['SERVER_NAME'] ) ) {
$_SERVER['SERVER_NAME'] = 'ga_integration_test';
}
}

/**
Expand Down

0 comments on commit db107f7

Please sign in to comment.