Debian Codegraph @

tests/phpunit/mocks/session/DummySessionProvider.php

raw symbols SCIP
1 <?php
2
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;
8
9 /**
10 * Dummy session provider
11 *
12 * An implementation of a session provider that doesn't actually do anything.
13 */
14 class DummySessionProvider extends SessionProvider {
15
16 public const ID = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
17
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 ] );
25 }
26
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 ] );
35 }
36
37 public function persistsSessionId() {
38 return true;
39 }
40
41 public function canChangeUser() {
42 return $this->persistsSessionId();
43 }
44
45 public function persistSession( SessionBackend $session, WebRequest $request ) {
46 }
47
48 public function unpersistSession( WebRequest $request ) {
49 }
50
51 public function immutableSessionCouldExistForUser( $user ) {
52 return false;
53 }
54
55 public function preventImmutableSessionsForUser( $user ) {
56 }
57
58 public function suggestLoginUsername( WebRequest $request ) {
59 return $request->getCookie( 'UserName' );
60 }
61
62 }