Skip to content

Commit aa8cfda

Browse files
committed
Test the filter impact to the new helper
1 parent 5f7783d commit aa8cfda

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/class-two-factor-core.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -1558,13 +1558,16 @@ public function test_all_sessions_destroyed_when_enabling_2fa_by_admin() {
15581558

15591559
public function test_can_filter_registered_providers_for_user() {
15601560
$user = self::factory()->user->create_and_get();
1561+
$providers = Two_Factor_Core::get_providers();
15611562

15621563
$this->assertEquals(
1563-
Two_Factor_Core::get_providers(),
1564+
$providers,
15641565
Two_Factor_Core::get_supported_providers_for_user( $user ),
15651566
'All providers are available by default'
15661567
);
15671568

1569+
$this->assertTrue( $providers['Two_Factor_Email']::is_supported_for_user( $user ), 'Email provider is supported by default' );
1570+
15681571
add_filter(
15691572
'two_factor_providers_for_user',
15701573
function( $providers, $user ) {
@@ -1582,6 +1585,8 @@ function( $providers, $user ) {
15821585
'Email provider can be disabled for a user'
15831586
);
15841587

1588+
$this->assertFalse( $providers['Two_Factor_Email']::is_supported_for_user( $user ), 'Email provider is disabled if not supported' );
1589+
15851590
remove_all_filters( 'two_factor_providers_for_user' );
15861591
}
15871592

0 commit comments

Comments
 (0)