MediaWiki  1.32.5
MediaWiki\Session\TestUtils Class Reference

Utility functions for Session unit tests. More...

Static Public Member Functions

static getDummySession ( $backend=null, $index=-1, $logger=null)
 If you need a Session for testing but don't want to create a backend to construct one, use this. More...
 
static getDummySessionBackend ()
 If you need a SessionBackend for testing but don't want to create a real one, use this. More...
 
static setSessionManagerSingleton (SessionManager $manager=null)
 Override the singleton for unit testing. More...
 

Detailed Description

Utility functions for Session unit tests.

Definition at line 11 of file TestUtils.php.

Member Function Documentation

◆ getDummySession()

static MediaWiki\Session\TestUtils::getDummySession (   $backend = null,
  $index = -1,
  $logger = null 
)
static

If you need a Session for testing but don't want to create a backend to construct one, use this.

Parameters
object | null$backendObject to serve as the SessionBackend
int$index
LoggerInterface | null$logger
Returns
Session

Definition at line 86 of file TestUtils.php.

References class.

Referenced by MediaWiki\Session\SessionTest\testArrayAccess(), MediaWiki\Session\SessionTest\testClear(), MediaWiki\Session\SessionTest\testDataAccess(), MediaWiki\Session\SessionTest\testMethods(), MediaWiki\Session\SessionTest\testSecrets(), MediaWiki\Session\SessionTest\testSecretsRoundTripping(), MediaWiki\Session\SessionTest\testTokens(), and UserTest\testUserGetRightsHooks().

◆ getDummySessionBackend()

static MediaWiki\Session\TestUtils::getDummySessionBackend ( )
static

If you need a SessionBackend for testing but don't want to create a real one, use this.

Returns
SessionBackend Unconfigured! Use reflection to set any private fields necessary.

Definition at line 65 of file TestUtils.php.

References $ret, and class.

Referenced by MediaWiki\Session\SessionTest\testConstructor(), MediaWiki\Session\SessionProviderTest\testGetAllowedUserRights(), and MediaWiki\Session\BotPasswordSessionProviderTest\testGetAllowedUserRights().

◆ setSessionManagerSingleton()


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