Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / mocks / session / DummySessionProvider.php
blob4ba4c49468db4904c34a3ea72d44ccca99399288
1 <?php
3 use MediaWiki\Request\WebRequest;
4 use MediaWiki\Session\SessionBackend;
5 use MediaWiki\Session\SessionInfo;
6 use MediaWiki\Session\SessionProvider;
7 use MediaWiki\Session\UserInfo;
9 /**
10 * Dummy session provider
12 * An implementation of a session provider that doesn't actually do anything.
14 class DummySessionProvider extends SessionProvider {
16 public const ID = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
18 public function provideSessionInfo( WebRequest $request ) {
19 return new SessionInfo( SessionInfo::MIN_PRIORITY, [
20 'provider' => $this,
21 'id' => self::ID,
22 'persisted' => true,
23 'userInfo' => UserInfo::newAnonymous(),
24 ] );
27 public function newSessionInfo( $id = null ) {
28 return new SessionInfo( SessionInfo::MIN_PRIORITY, [
29 'id' => $id,
30 'idIsSafe' => true,
31 'provider' => $this,
32 'persisted' => false,
33 'userInfo' => UserInfo::newAnonymous(),
34 ] );
37 public function persistsSessionId() {
38 return true;
41 public function canChangeUser() {
42 return $this->persistsSessionId();
45 public function persistSession( SessionBackend $session, WebRequest $request ) {
48 public function unpersistSession( WebRequest $request ) {
51 public function immutableSessionCouldExistForUser( $user ) {
52 return false;
55 public function preventImmutableSessionsForUser( $user ) {
58 public function suggestLoginUsername( WebRequest $request ) {
59 return $request->getCookie( 'UserName' );