Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccahum committed Jul 6, 2022
1 parent d2498c4 commit f4ab087
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/search/includes/classes/test-class-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -3107,6 +3107,39 @@ public function test__are_es_constants_defined__no_endpoints() {
$this->assertFalse( $result );
}

public function test__filter_ep_enable_do_weighting__default_no_weighting() {
$this->search_instance->init();

$this->assertFalse( apply_filters( 'ep_enable_do_weighting', true, [], [], [] ) );
}

public function test__filter_ep_enable_do_weighting__anonymous_function() {
$this->search_instance->init();

add_filter(
'ep_weighting_configuration_for_search',
function( $weight_config ) {
return $weight_config;
}
);

$this->assertTrue( apply_filters( 'ep_enable_do_weighting', true, [], [], [] ) );
}

public function test__filter_ep_enable_do_weighting__class_function() {
$this->search_instance->init();

add_filter( 'ep_weighting_configuration_for_search', [ $this, 'some_function' ] );

$this->assertTrue( apply_filters( 'ep_enable_do_weighting', true, [], [], [] ) );
}

public function test__filter_ep_enable_do_weighting__weight_config() {
$this->search_instance->init();

$this->assertTrue( apply_filters( 'ep_enable_do_weighting', true, [ 'foo' => 'bar' ], [], [] ) );
}

/**
* Helper function for accessing protected methods.
*/
Expand Down

0 comments on commit f4ab087

Please sign in to comment.