From: Antoine Musso Date: Mon, 5 Mar 2012 11:48:35 +0000 (+0000) Subject: place holder to test bug 34919 when it is fixed X-Git-Tag: 1.31.0-rc.0~24397 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=3c098d1da5352280adbbd12fc50e2fd86e9648a4;p=lhc%2Fweb%2Fwiklou.git place holder to test bug 34919 when it is fixed --- 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; + } + +}