Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / tests / phpunit / mocks / session / DummySessionProvider.php
blobdcbb101a0742d9a3ee539ba67bf1043d8e77d37d
1 <?php
2 use MediaWiki\Session\SessionProvider;
3 use MediaWiki\Session\SessionInfo;
4 use MediaWiki\Session\SessionBackend;
5 use MediaWiki\Session\UserInfo;
7 /**
8 * Dummy session provider
10 * An implementation of a session provider that doesn't actually do anything.
12 class DummySessionProvider extends SessionProvider {
14 const ID = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
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 ] );
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 ] );
35 public function persistsSessionId() {
36 return true;
39 public function canChangeUser() {
40 return $this->persistsSessionId();
43 public function persistSession( SessionBackend $session, WebRequest $request ) {
46 public function unpersistSession( WebRequest $request ) {
49 public function immutableSessionCouldExistForUser( $user ) {
50 return false;
53 public function preventImmutableSessionsForUser( $user ) {
56 public function suggestLoginUsername( WebRequest $request ) {
57 return $request->getCookie( 'UserName' );