wiki.techinc.nl/tests/phpunit/includes/auth/RememberMeAuthenticationRequestTest.php
Brad Jorsch d245bd25ae Add AuthManager
This implements the AuthManager class and its needed interfaces and
subclasses, and integrates them into the backend portion of MediaWiki.
Integration with frontend portions of MediaWiki (e.g. ApiLogin,
Special:Login) is left for a followup.

Bug: T91699
Bug: T71589
Bug: T111299
Co-Authored-By: Gergő Tisza <gtisza@wikimedia.org>
Change-Id: If89d24838e326fe25fe867d02181eebcfbb0e196
2016-05-16 15:11:02 +00:00

55 lines
1.3 KiB
PHP

<?php
namespace MediaWiki\Auth;
/**
* @group AuthManager
* @covers MediaWiki\Auth\RememberMeAuthenticationRequest
*/
class RememberMeAuthenticationRequestTest extends AuthenticationRequestTestCase {
public static function provideGetFieldInfo() {
return [
[ [ 1 ] ],
[ [ null ] ],
];
}
public function testGetFieldInfo_2() {
$req = new RememberMeAuthenticationRequest();
$reqWrapper = \TestingAccessWrapper::newFromObject( $req );
$reqWrapper->expiration = 30 * 24 * 3600;
$this->assertNotEmpty( $req->getFieldInfo() );
$reqWrapper->expiration = null;
$this->assertEmpty( $req->getFieldInfo() );
}
protected function getInstance( array $args = [] ) {
$req = new RememberMeAuthenticationRequest();
$reqWrapper = \TestingAccessWrapper::newFromObject( $req );
$reqWrapper->expiration = $args[0];
return $req;
}
public function provideLoadFromSubmission() {
return [
'Empty request' => [
[ 30 * 24 * 3600 ],
[],
[ 'expiration' => 30 * 24 * 3600, 'rememberMe' => false ]
],
'RememberMe present' => [
[ 30 * 24 * 3600 ],
[ 'rememberMe' => '' ],
[ 'expiration' => 30 * 24 * 3600, 'rememberMe' => true ]
],
'RememberMe present but session provider cannot remember' => [
[ null ],
[ 'rememberMe' => '' ],
false
],
];
}
}