From 3c098d1da5352280adbbd12fc50e2fd86e9648a4 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Mon, 5 Mar 2012 11:48:35 +0000 Subject: [PATCH] place holder to test bug 34919 when it is fixed --- tests/phpunit/includes/PreferencesTest.php | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 tests/phpunit/includes/PreferencesTest.php diff --git a/tests/phpunit/includes/PreferencesTest.php b/tests/phpunit/includes/PreferencesTest.php new file mode 100644 index 0000000000..47aaf3dbf6 --- /dev/null +++ b/tests/phpunit/includes/PreferencesTest.php @@ -0,0 +1,71 @@ +users['noemail'] = new User; + + $this->users['notauth'] = new User; + $this->users['notauth'] + ->setEmail( 'noauth@example.org' ); + + $this->users['auth'] = new User; + $this->users['auth'] + ->setEmail( 'noauth@example.org' ); + $this->users['auth'] + ->setEmailAuthenticationTimestamp( 1330946623 ); + + $this->context = new RequestContext; + $this->context->setTitle( Title::newFromText('PreferencesTest') ); + } + + /** + * Placeholder to verify bug 34919 + * @covers Preferences::profilePreferences + */ + function testEmailFieldsWhenUserHasNoEmail() { + $prefs = $this->prefsFor( 'noemail' ); + $this->assertArrayNotHasKey( 'class', + $prefs['emailaddress'] + ); + } + /** + * Placeholder to verify bug 34919 + * @covers Preferences::profilePreferences + */ + function testEmailFieldsWhenUserEmailNotAuthenticated() { + $prefs = $this->prefsFor( 'notauth' ); + $this->assertArrayNotHasKey( 'class', + $prefs['emailaddress'] + ); + } + /** + * Placeholder to verify bug 34919 + * @covers Preferences::profilePreferences + */ + function testEmailFieldsWhenUserEmailIsAuthenticated() { + $prefs = $this->prefsFor( 'auth' ); + $this->assertArrayNotHasKey( 'class', + $prefs['emailaddress'] + ); + } + + + /** Helper */ + function prefsFor( $user_key ) { + $preferences = array(); + Preferences::profilePreferences( + $this->users[$user_key] + , $this->context + , $preferences + ); + return $preferences; + } + +} -- 2.20.1