MediaWiki  1.34.0
CaptchaPreAuthenticationProviderTest Class Reference

@covers CaptchaPreAuthenticationProvider @group Database More...

Inheritance diagram for CaptchaPreAuthenticationProviderTest:
Collaboration diagram for CaptchaPreAuthenticationProviderTest:

Public Member Functions

 provideGetAuthenticationRequests ()
 
 providePingLimiter ()
 
 provideTestForAccountCreation ()
 
 provideTestForAuthentication ()
 
 setUp ()
 
 tearDown ()
 
 testGetAuthenticationRequests ( $action, $username, $triggers, $needsCaptcha, $preTestCallback=null)
 @dataProvider provideGetAuthenticationRequests More...
 
 testGetAuthenticationRequests_store ()
 
 testPingLimiter (array $attempts)
 @dataProvider providePingLimiter More...
 
 testPostAuthentication ()
 
 testPostAuthentication_disabled ()
 
 testTestForAccountCreation ( $req, $creator, $result, $disableTrigger=false)
 @dataProvider provideTestForAccountCreation More...
 
 testTestForAuthentication ( $req, $isBadLoginTriggered, $isBadLoginPerUserTriggered, $result)
 @dataProvider provideTestForAuthentication More...
 

Protected Member Functions

 blockLogin ( $username)
 
 flagSession ()
 
 getCaptchaRequest ( $id, $word, $username=null)
 
 setMwHook ( $hook, callable $callback)
 Set a $wgHooks handler for a given hook and remove all other handlers (though not ones set via Hooks::register). More...
 
 setTriggers ( $triggers)
 

Detailed Description

@covers CaptchaPreAuthenticationProvider @group Database

Definition at line 11 of file CaptchaPreAuthenticationProviderTest.php.

Member Function Documentation

◆ blockLogin()

CaptchaPreAuthenticationProviderTest::blockLogin (   $username)
protected

Definition at line 276 of file CaptchaPreAuthenticationProviderTest.php.

◆ flagSession()

CaptchaPreAuthenticationProviderTest::flagSession ( )
protected

◆ getCaptchaRequest()

CaptchaPreAuthenticationProviderTest::getCaptchaRequest (   $id,
  $word,
  $username = null 
)
protected

◆ provideGetAuthenticationRequests()

CaptchaPreAuthenticationProviderTest::provideGetAuthenticationRequests ( )

Definition at line 64 of file CaptchaPreAuthenticationProviderTest.php.

References true.

◆ providePingLimiter()

CaptchaPreAuthenticationProviderTest::providePingLimiter ( )

◆ provideTestForAccountCreation()

CaptchaPreAuthenticationProviderTest::provideTestForAccountCreation ( )

◆ provideTestForAuthentication()

CaptchaPreAuthenticationProviderTest::provideTestForAuthentication ( )

Definition at line 125 of file CaptchaPreAuthenticationProviderTest.php.

References $fallback, getCaptchaRequest(), and true.

◆ setMwHook()

CaptchaPreAuthenticationProviderTest::setMwHook (   $hook,
callable  $callback 
)
protected

Set a $wgHooks handler for a given hook and remove all other handlers (though not ones set via Hooks::register).

The original state will be restored after the test.

Parameters
string$hookHook name
callable$callbackHook method

Definition at line 301 of file CaptchaPreAuthenticationProviderTest.php.

Referenced by testPingLimiter(), testTestForAccountCreation(), and testTestForAuthentication().

◆ setTriggers()

CaptchaPreAuthenticationProviderTest::setTriggers (   $triggers)
protected

◆ setUp()

CaptchaPreAuthenticationProviderTest::setUp ( )

◆ tearDown()

CaptchaPreAuthenticationProviderTest::tearDown ( )

Definition at line 31 of file CaptchaPreAuthenticationProviderTest.php.

◆ testGetAuthenticationRequests()

CaptchaPreAuthenticationProviderTest::testGetAuthenticationRequests (   $action,
  $username,
  $triggers,
  $needsCaptcha,
  $preTestCallback = null 
)

@dataProvider provideGetAuthenticationRequests

Definition at line 40 of file CaptchaPreAuthenticationProviderTest.php.

References RequestContext\getMain(), and setTriggers().

◆ testGetAuthenticationRequests_store()

CaptchaPreAuthenticationProviderTest::testGetAuthenticationRequests_store ( )

Definition at line 82 of file CaptchaPreAuthenticationProviderTest.php.

References setTriggers().

◆ testPingLimiter()

CaptchaPreAuthenticationProviderTest::testPingLimiter ( array  $attempts)

@dataProvider providePingLimiter

Definition at line 215 of file CaptchaPreAuthenticationProviderTest.php.

References $success, CaptchaStore\get(), and setMwHook().

◆ testPostAuthentication()

CaptchaPreAuthenticationProviderTest::testPostAuthentication ( )

◆ testPostAuthentication_disabled()

CaptchaPreAuthenticationProviderTest::testPostAuthentication_disabled ( )

◆ testTestForAccountCreation()

CaptchaPreAuthenticationProviderTest::testTestForAccountCreation (   $req,
  $creator,
  $result,
  $disableTrigger = false 
)

@dataProvider provideTestForAccountCreation

Definition at line 143 of file CaptchaPreAuthenticationProviderTest.php.

References $status, CaptchaStore\get(), User\newFromName(), setMwHook(), and setTriggers().

◆ testTestForAuthentication()

CaptchaPreAuthenticationProviderTest::testTestForAuthentication (   $req,
  $isBadLoginTriggered,
  $isBadLoginPerUserTriggered,
  $result 
)

@dataProvider provideTestForAuthentication

Definition at line 102 of file CaptchaPreAuthenticationProviderTest.php.

References $status, CaptchaStore\get(), and setMwHook().


The documentation for this class was generated from the following file: