Move ResultWrapper subclasses to Rdbms
[mediawiki.git] / tests / phpunit / includes / auth / RememberMeAuthenticationRequestTest.php
blob3f90169cacf148fd680578b74a57e38c1b2d5503
1 <?php
3 namespace MediaWiki\Auth;
5 /**
6 * @group AuthManager
7 * @covers MediaWiki\Auth\RememberMeAuthenticationRequest
8 */
9 class RememberMeAuthenticationRequestTest extends AuthenticationRequestTestCase {
11 public static function provideGetFieldInfo() {
12 return [
13 [ [ 1 ] ],
14 [ [ null ] ],
18 public function testGetFieldInfo_2() {
19 $req = new RememberMeAuthenticationRequest();
20 $reqWrapper = \TestingAccessWrapper::newFromObject( $req );
22 $reqWrapper->expiration = 30 * 24 * 3600;
23 $this->assertNotEmpty( $req->getFieldInfo() );
25 $reqWrapper->expiration = null;
26 $this->assertEmpty( $req->getFieldInfo() );
29 protected function getInstance( array $args = [] ) {
30 $req = new RememberMeAuthenticationRequest();
31 $reqWrapper = \TestingAccessWrapper::newFromObject( $req );
32 $reqWrapper->expiration = $args[0];
33 return $req;
36 public function provideLoadFromSubmission() {
37 return [
38 'Empty request' => [
39 [ 30 * 24 * 3600 ],
40 [],
41 [ 'expiration' => 30 * 24 * 3600, 'rememberMe' => false ]
43 'RememberMe present' => [
44 [ 30 * 24 * 3600 ],
45 [ 'rememberMe' => '' ],
46 [ 'expiration' => 30 * 24 * 3600, 'rememberMe' => true ]
48 'RememberMe present but session provider cannot remember' => [
49 [ null ],
50 [ 'rememberMe' => '' ],
51 false