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->assertArrayNotHasKey( 'class',
35 $prefs['emailaddress']
39 * Placeholder to verify bug 34302
40 * @covers Preferences::profilePreferences
42 function testEmailFieldsWhenUserEmailNotAuthenticated() {
43 $prefs = $this->prefsFor( 'notauth' );
44 $this->assertArrayNotHasKey( 'class',
45 $prefs['emailaddress']
49 * Placeholder to verify bug 34302
50 * @covers Preferences::profilePreferences
52 function testEmailFieldsWhenUserEmailIsAuthenticated() {
53 $prefs = $this->prefsFor( 'auth' );
54 $this->assertArrayNotHasKey( 'class',
55 $prefs['emailaddress']
61 function prefsFor( $user_key ) {
62 $preferences = array();
63 Preferences
::profilePreferences(
64 $this->users
[$user_key]