Skip to content

Commit

Permalink
Keep together similar tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd committed Feb 14, 2025
1 parent 2bb236f commit 5422ba1
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/class-two-factor-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,21 @@ function( $providers, $user ) {
remove_all_filters( 'two_factor_providers_for_user' );
}

public function test_can_disable_default_providers() {
$this->assertContains( 'Two_Factor_Email', array_keys( Two_Factor_Core::get_providers() ), 'Email provider is enabled by default' );

add_filter(
'two_factor_providers',
function ( $providers ) {
return array_diff_key( $providers, array( 'Two_Factor_Email' => null ) );
}
);

$this->assertNotContains( 'Two_Factor_Email', array_keys( Two_Factor_Core::get_providers() ), 'Default provider can be disabled via a filter' );

remove_all_filters( 'two_factor_providers' );
}

/**
* Plugin uninstall removes all user meta.
*
Expand All @@ -1611,21 +1626,6 @@ public function test_uninstall_removes_user_meta() {
);
}

public function test_can_disable_default_providers() {
$this->assertContains( 'Two_Factor_Email', array_keys( Two_Factor_Core::get_providers() ), 'Email provider is enabled by default' );

add_filter(
'two_factor_providers',
function ( $providers ) {
return array_diff_key( $providers, array( 'Two_Factor_Email' => null ) );
}
);

$this->assertNotContains( 'Two_Factor_Email', array_keys( Two_Factor_Core::get_providers() ), 'Default provider can be disabled via a filter' );

remove_all_filters( 'two_factor_providers' );
}

/**
* Plugin uninstall removes all user meta even for disabled providers.
*
Expand Down

0 comments on commit 5422ba1

Please sign in to comment.