* @covers MediaWiki\Auth\AuthenticationResponse
*/
class AuthenticationResponseTest extends \MediaWikiTestCase {
- protected function setUp() {
- global $wgDisableAuthManager;
-
- parent::setUp();
- if ( $wgDisableAuthManager ) {
- $this->markTestSkipped( '$wgDisableAuthManager is set' );
- }
- }
-
/**
* @dataProvider provideConstructors
* @param string $constructor
public function testConstructors( $constructor, $args, $expect ) {
if ( is_array( $expect ) ) {
$res = new AuthenticationResponse();
+ $res->messageType = 'warning';
foreach ( $expect as $field => $value ) {
$res->$field = $value;
}
[ 'newFail', [ $msg ], [
'status' => AuthenticationResponse::FAIL,
'message' => $msg,
+ 'messageType' => 'error',
] ],
[ 'newRestart', [ $msg ], [
'status' => AuthenticationResponse::UI,
'neededRequests' => [ $req ],
'message' => $msg,
+ 'messageType' => 'warning',
+ ] ],
+
+ [ 'newUI', [ [ $req ], $msg, 'warning' ], [
+ 'status' => AuthenticationResponse::UI,
+ 'neededRequests' => [ $req ],
+ 'message' => $msg,
+ 'messageType' => 'warning',
+ ] ],
+
+ [ 'newUI', [ [ $req ], $msg, 'error' ], [
+ 'status' => AuthenticationResponse::UI,
+ 'neededRequests' => [ $req ],
+ 'message' => $msg,
+ 'messageType' => 'error',
] ],
[ 'newUI', [ [], $msg ],
new \InvalidArgumentException( '$reqs may not be empty' )