rdbms: Rename "memCache" to "memStash" in LBFactory
[mediawiki.git] / tests / phpunit / includes / auth / RememberMeAuthenticationRequestTest.php
blob9bcab77738b05a1b7433b7e7e7008ad19547b63f
1 <?php
3 namespace MediaWiki\Auth;
5 use Wikimedia\TestingAccessWrapper;
7 /**
8 * @group AuthManager
9 * @covers MediaWiki\Auth\RememberMeAuthenticationRequest
11 class RememberMeAuthenticationRequestTest extends AuthenticationRequestTestCase {
13 public static function provideGetFieldInfo() {
14 return [
15 [ [ 1 ] ],
16 [ [ null ] ],
20 public function testGetFieldInfo_2() {
21 $req = new RememberMeAuthenticationRequest();
22 $reqWrapper = TestingAccessWrapper::newFromObject( $req );
24 $reqWrapper->expiration = 30 * 24 * 3600;
25 $this->assertNotEmpty( $req->getFieldInfo() );
27 $reqWrapper->expiration = null;
28 $this->assertEmpty( $req->getFieldInfo() );
31 protected function getInstance( array $args = [] ) {
32 $req = new RememberMeAuthenticationRequest();
33 $reqWrapper = TestingAccessWrapper::newFromObject( $req );
34 $reqWrapper->expiration = $args[0];
35 return $req;
38 public function provideLoadFromSubmission() {
39 return [
40 'Empty request' => [
41 [ 30 * 24 * 3600 ],
42 [],
43 [ 'expiration' => 30 * 24 * 3600, 'rememberMe' => false ]
45 'RememberMe present' => [
46 [ 30 * 24 * 3600 ],
47 [ 'rememberMe' => '' ],
48 [ 'expiration' => 30 * 24 * 3600, 'rememberMe' => true ]
50 'RememberMe present but session provider cannot remember' => [
51 [ null ],
52 [ 'rememberMe' => '' ],
53 false