Skip to content

Commit

Permalink
Clean up output from various tests (#34256)
Browse files Browse the repository at this point in the history
Tests shouldn't produce extraneous output to the console, but some of
ours were.

* packages/blaze: Prints URLs due to not passing `false` for the
  `$display` parameter to `menu_page_url()`.
* packages/connection: `error_log()` output, which we can redirect to
  /dev/null.
* packages/forms: In CI it prints a bunch of "sh: 1: /usr/sbin/sendmail:
  not found", while locally it doesn't because that exists and it
  **actually sends mail** (to an example.com address, at least, which
  has no MX and so is undeliverable). The 'pre_wp_mail' filter easily
  prevents the sending of mail.
* plugins/jetpack: Output from sync, which we can expect as part of the
  test.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/6961138026
  • Loading branch information
anomiex authored and matticbot committed Nov 22, 2023
1 parent d73763d commit 5608acb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.3-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

## [2.0.2] - 2023-11-21
### Changed
- Replaced usage of strpos() with str_contains(). [#34137]
Expand Down Expand Up @@ -929,6 +933,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Separate the connection library into its own package.

[2.0.3-alpha]: https://github.com/Automattic/jetpack-connection/compare/v2.0.2...v2.0.3-alpha
[2.0.2]: https://github.com/Automattic/jetpack-connection/compare/v2.0.1...v2.0.2
[2.0.1]: https://github.com/Automattic/jetpack-connection/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/Automattic/jetpack-connection/compare/v1.60.1...v2.0.0
Expand Down
2 changes: 1 addition & 1 deletion src/class-package-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '2.0.2';
const PACKAGE_VERSION = '2.0.3-alpha';

const PACKAGE_SLUG = 'connection';

Expand Down
14 changes: 12 additions & 2 deletions tests/php/test_Server_Sandbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ public function test_server_sandbox( $sandbox_constant, $url, $expected_url, $ex
Constants::set_constant( 'JETPACK__SANDBOX_DOMAIN', $sandbox_constant );
$headers = array();

( new Server_Sandbox() )->server_sandbox( $url, $headers );
ini_set( 'error_log', '/dev/null' );
try {
( new Server_Sandbox() )->server_sandbox( $url, $headers );
} finally {
ini_restore( 'error_log' );
}

$this->assertSame( $expected_url, $url );
$this->assertSame( $expected_headers, $headers );
Expand Down Expand Up @@ -205,7 +210,12 @@ public function test_server_sandbox_with_xdebug( $url, $expected_url, $add_filte
add_filter( 'jetpack_sandbox_add_profile_parameter', '__return_true' );
}

( new Server_Sandbox() )->server_sandbox( $url, $headers, $body, $method );
ini_set( 'error_log', '/dev/null' );
try {
( new Server_Sandbox() )->server_sandbox( $url, $headers, $body, $method );
} finally {
ini_restore( 'error_log' );
}

$this->assertSame( $expected_url, $url );

Expand Down

0 comments on commit 5608acb

Please sign in to comment.