Merge "Improve return types in class MagicWordArray"
[lhc/web/wiklou.git] / tests / phpunit / mocks / session / DummySessionProvider.php
1 <?php
2
3 use MediaWiki\Session\SessionProvider;
4 use MediaWiki\Session\SessionInfo;
5 use MediaWiki\Session\SessionBackend;
6 use MediaWiki\Session\UserInfo;
7
8 /**
9 * Dummy session provider
10 *
11 * An implementation of a session provider that doesn't actually do anything.
12 */
13 class DummySessionProvider extends SessionProvider {
14
15 const ID = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
16
17 public function provideSessionInfo( WebRequest $request ) {
18 return new SessionInfo( SessionInfo::MIN_PRIORITY, [
19 'provider' => $this,
20 'id' => self::ID,
21 'persisted' => true,
22 'userInfo' => UserInfo::newAnonymous(),
23 ] );
24 }
25
26 public function newSessionInfo( $id = null ) {
27 return new SessionInfo( SessionInfo::MIN_PRIORITY, [
28 'id' => $id,
29 'idIsSafe' => true,
30 'provider' => $this,
31 'persisted' => false,
32 'userInfo' => UserInfo::newAnonymous(),
33 ] );
34 }
35
36 public function persistsSessionId() {
37 return true;
38 }
39
40 public function canChangeUser() {
41 return $this->persistsSessionId();
42 }
43
44 public function persistSession( SessionBackend $session, WebRequest $request ) {
45 }
46
47 public function unpersistSession( WebRequest $request ) {
48 }
49
50 public function immutableSessionCouldExistForUser( $user ) {
51 return false;
52 }
53
54 public function preventImmutableSessionsForUser( $user ) {
55 }
56
57 public function suggestLoginUsername( WebRequest $request ) {
58 return $request->getCookie( 'UserName' );
59 }
60
61 }