3 class PreferencesTest
extends MediaWikiTestCase
{
5 /** Array of User objects */
9 function __construct() {
10 parent
::__construct();
12 $this->users
['noemail'] = new User
;
14 $this->users
['notauth'] = new User
;
15 $this->users
['notauth']
16 ->setEmail( 'noauth@example.org' );
18 $this->users
['auth'] = new User
;
20 ->setEmail( 'noauth@example.org' );
22 ->setEmailAuthenticationTimestamp( 1330946623 );
24 $this->context
= new RequestContext
;
25 $this->context
->setTitle( Title
::newFromText('PreferencesTest') );
29 * Placeholder to verify bug 34302
30 * @covers Preferences::profilePreferences
32 function testEmailFieldsWhenUserHasNoEmail() {
33 $prefs = $this->prefsFor( 'noemail' );
34 $this->assertArrayHasKey( 'cssclass',
35 $prefs['emailaddress']
37 $this->assertEquals( 'mw-email-none', $prefs['emailaddress']['cssclass'] );
40 * Placeholder to verify bug 34302
41 * @covers Preferences::profilePreferences
43 function testEmailFieldsWhenUserEmailNotAuthenticated() {
44 $prefs = $this->prefsFor( 'notauth' );
45 $this->assertArrayHasKey( 'cssclass',
46 $prefs['emailaddress']
48 $this->assertEquals( 'mw-email-not-authenticated', $prefs['emailaddress']['cssclass'] );
51 * Placeholder to verify bug 34302
52 * @covers Preferences::profilePreferences
54 function testEmailFieldsWhenUserEmailIsAuthenticated() {
55 $prefs = $this->prefsFor( 'auth' );
56 $this->assertArrayHasKey( 'cssclass',
57 $prefs['emailaddress']
59 $this->assertEquals( 'mw-email-authenticated', $prefs['emailaddress']['cssclass'] );
64 function prefsFor( $user_key ) {
65 $preferences = array();
66 Preferences
::profilePreferences(
67 $this->users
[$user_key]