Skip to content

Commit

Permalink
Add a test for the blank thing
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd committed Aug 26, 2020
1 parent 8c5584b commit e200e0e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/providers/class-two-factor-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,22 @@ public function test_validate_authentication() {
unset( $_REQUEST['two-factor-email-code'] );
}

/**
* Can strip away blank spaces and new line characters in code input.
*
* @covers Two_Factor_Email::validate_authentication
*/
public function test_validate_authentication_code_with_spaces() {
$user = new WP_User( $this->factory->user->create() );

$token = $this->provider->generate_token( $user->ID );
$_REQUEST['two-factor-email-code'] = sprintf( ' %s ', $token );

$this->assertTrue( $this->provider->validate_authentication( $user ) );

unset( $_REQUEST['two-factor-email-code'] );
}

/**
* Verify that availability returns true.
*
Expand Down

0 comments on commit e200e0e

Please sign in to comment.