Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / mocks / session / DummySessionBackend.php
blobbb4d55403ce4c773bc747eaf593e0f6947586db4
1 <?php
3 namespace MediaWiki\Tests\Session;
5 use MediaWiki\User\User;
7 /**
8 * Dummy session backend
10 * This isn't a real backend, but implements some methods that SessionBackend
11 * does so tests can run.
13 * FIXME This class is a huge hack, and it won't work e.g. as methods in Session(Backend) are typehinted.
14 * SessionBackend should be mocked directly instead, but that's currently impossible because the class is final.
15 * At the very least, there should be an interface that SessionBackend implements, and that could also be used
16 * for mocks.
18 class DummySessionBackend {
19 /** @var array */
20 public $data = [
21 'foo' => 1,
22 'bar' => 2,
23 0 => 'zero',
25 /** @var bool */
26 public $dirty = false;
28 public function &getData() {
29 return $this->data;
32 public function dirty() {
33 $this->dirty = true;
36 public function getUser(): User {
37 return new User();
40 public function deregisterSession( $index ) {