diff --git a/tests/test-template.php b/tests/test-template.php index 2d3ed52d7..6d81766f0 100644 --- a/tests/test-template.php +++ b/tests/test-template.php @@ -31,7 +31,9 @@ public function test_wp_service_worker_offline_page_reload() { $error_template_url = add_query_arg( 'wp_error_template', 'offline', home_url( '/', 'relative' ) ); $this->go_to( $error_template_url ); - $actual_script = wp_service_worker_offline_page_reload(); + ob_start(); + wp_service_worker_offline_page_reload(); + $actual_script = ob_get_clean(); $this->assertEquals( $_SERVER['REQUEST_METHOD'], 'GET' ); $this->assertTrue( is_offline() ); $this->assertFalse( is_500() ); @@ -42,7 +44,9 @@ public function test_wp_service_worker_offline_page_reload() { $error_template_url = add_query_arg( 'wp_error_template', '500', home_url( '/', 'relative' ) ); $this->go_to( $error_template_url ); - $actual_script = wp_service_worker_offline_page_reload(); + ob_start(); + wp_service_worker_offline_page_reload(); + $actual_script = ob_get_clean(); $this->assertEquals( $_SERVER['REQUEST_METHOD'], 'GET' ); $this->assertFalse( is_offline() ); $this->assertTrue( is_500() );