X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/tests/phpunit/includes/auth/RememberMeAuthenticationRequestTest.php diff --git a/tests/phpunit/includes/auth/RememberMeAuthenticationRequestTest.php b/tests/phpunit/includes/auth/RememberMeAuthenticationRequestTest.php new file mode 100644 index 00000000..9bcab777 --- /dev/null +++ b/tests/phpunit/includes/auth/RememberMeAuthenticationRequestTest.php @@ -0,0 +1,57 @@ +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 + ], + ]; + } +}