Skip to content

Commit

Permalink
Cover Integrations 100%.
Browse files Browse the repository at this point in the history
  • Loading branch information
kagg-design committed Nov 3, 2024
1 parent 6c18c86 commit d1562aa
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .tests/php/unit/Settings/IntegrationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,37 @@ public function test_init_hooks(): void {
$subject->$method();
}

/**
* Test after_switch_theme_action().
*
* @return void
*/
public function test_after_switch_theme_action(): void {
$subject = Mockery::mock( Integrations::class )->makePartial();

$subject->shouldAllowMockingProtectedMethods();

$subject->shouldReceive( 'run_checks' )->once()->with( $subject::ACTIVATE_ACTION );

WP_Mock::userFunction( 'wp_doing_ajax' )->once()->with()->andReturn( true );
WP_Mock::userFunction( 'remove_action' )->once()->with( 'after_switch_theme', 'et_onboarding_trigger_redirect' );

$subject->after_switch_theme_action();
}

/**
* Test after_switch_theme_action() when not ajax.
*
* @return void
*/
public function test_after_switch_theme_action_when_not_ajax(): void {
$subject = Mockery::mock( Integrations::class )->makePartial();

WP_Mock::userFunction( 'wp_doing_ajax' )->once()->with()->andReturn( false );

$subject->after_switch_theme_action();
}

/**
* Test init_form_fields().
*
Expand Down

0 comments on commit d1562aa

Please sign in to comment.