Skip to content

Commit

Permalink
Test during API requests
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd committed Jan 10, 2025
1 parent b9c200d commit 7cb84f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/class-two-factor-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,15 @@ public function test_is_api_request() {
*
* @covers Two_Factor_Core::filter_authenticate
*/
public function test_filter_authenticate() {
public function test_filter_authenticate_api() {
$user_default = new WP_User( self::factory()->user->create() );
$user_2fa_enabled = $this->get_dummy_user(); // User with a dummy two-factor method enabled.

// TODO: Get Two_Factor_Core away from static methods to allow mocking this.
define( 'XMLRPC_REQUEST', true );

$this->assertTrue( Two_Factor_Core::is_api_request(), 'Can detect an API request' );

$this->assertInstanceOf(
'WP_User',
Two_Factor_Core::filter_authenticate( $user_default, 'username', 'password' ),
Expand Down

0 comments on commit 7cb84f5

Please sign in to comment.