Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Did you mean #3425

Merged
merged 15 commits into from
Jun 7, 2023
Prev Previous commit
Next Next commit
Improve code
  • Loading branch information
burhandodhy committed Jun 7, 2023
commit e848a04eb98e201e0e34847e0bdd9cb233326105
54 changes: 21 additions & 33 deletions tests/php/features/TestDidYouMean.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,13 @@ public function testGetOriginalSearchTerm() {

ElasticPress\Elasticsearch::factory()->refresh_indices();

$filter = function() {
return [
'did-you-mean' => [
'search_behavior' => 'redirect',
'active' => true,
],
];
};

add_filter( 'pre_site_option_ep_feature_settings', $filter );
add_filter( 'pre_option_ep_feature_settings', $filter );
ElasticPress\Features::factory()->update_feature(
'did-you-mean',
[
'active' => true,
'search_behavior' => 'redirect',
]
);

parse_str( 'ep_suggestion_original_term=Original Term', $_GET );

Expand Down Expand Up @@ -340,17 +336,13 @@ public function testEPSuggestionsAction() {
]
);

$filter = function() {
return [
'did-you-mean' => [
'search_behavior' => 'redirect',
'active' => true,
],
];
};

add_filter( 'pre_site_option_ep_feature_settings', $filter );
add_filter( 'pre_option_ep_feature_settings', $filter );
ElasticPress\Features::factory()->update_feature(
'did-you-mean',
[
'active' => true,
'search_behavior' => 'redirect',
]
);

parse_str( 'ep_suggestion_original_term=Original Term', $_GET );

Expand Down Expand Up @@ -381,17 +373,13 @@ public function testEPSuggestionsActionOtherThanMainQuery() {
]
);

$filter = function() {
return [
'did-you-mean' => [
'search_behavior' => 'redirect',
'active' => true,
],
];
};

add_filter( 'pre_site_option_ep_feature_settings', $filter );
add_filter( 'pre_option_ep_feature_settings', $filter );
ElasticPress\Features::factory()->update_feature(
'did-you-mean',
[
'active' => true,
'search_behavior' => 'redirect',
]
);

parse_str( 'ep_suggestion_original_term=Original Term', $_GET );

Expand Down