Skip to content

Commit

Permalink
add activate test when search is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
kangzj committed Nov 16, 2021
1 parent b5b22bb commit 87d0fc9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion projects/packages/search/tests/php/test-module-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,20 @@ public function test_activate_module() {
}

/**
* Test static::$search_module->activate()
* Test static::$search_module->activate() when search is not supported
*/
public function test_activate_module_not_supported() {
$plan = $this->createMock( Plan::class );
$plan->method( 'supports_search' )->willReturn( false );

$search_module = new Module_Control( $plan );
$search_module->activate();
// Cannot activate search if not supported.
$this->assertEquals( array(), get_option( 'jetpack_' . Module_Control::JETPACK_ACTIVE_MODULES_OPTION_KEY, array() ) );
}

/**
* Test static::$search_module->deactivate()
*/
public function test_deactivate_module() {
add_filter( 'jetpack_options', array( $this, 'return_search_active_array' ) );
Expand Down

0 comments on commit 87d0fc9

Please sign in to comment.