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