Skip to content

Commit

Permalink
Unit Tests: Fail faster on requests we know will fail
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Dec 11, 2024
1 parent f1397eb commit 90b0cfb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/php/TestAdminNotices.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@ public function testHostErrorNoticeInAdmin() {

remove_all_filters( 'ep_elasticsearch_version' );

// As we know the call will fail, let's fail faster.
add_filter(
'ep_pre_request_args',
function ( $args ) {
$args['timeout'] = 1;
return $args;
}
);

ElasticPress\Elasticsearch::factory()->get_elasticsearch_version( true );

ElasticPress\Screen::factory()->set_current_screen( null );
Expand Down Expand Up @@ -252,6 +261,15 @@ public function testHostErrorNoticeInInstall() {
delete_site_option( 'ep_need_upgrade_sync', true );
delete_site_option( 'ep_feature_auto_activated_sync' );

// As we know the call will fail, let's fail faster.
add_filter(
'ep_pre_request_args',
function ( $args ) {
$args['timeout'] = 1;
return $args;
}
);

ElasticPress\Elasticsearch::factory()->get_elasticsearch_version( true );

ElasticPress\Screen::factory()->set_current_screen( 'install' );
Expand Down

0 comments on commit 90b0cfb

Please sign in to comment.