https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113016

Revision: 113016
Author:   hashar
Date:     2012-03-05 11:48:35 +0000 (Mon, 05 Mar 2012)
Log Message:
-----------
place holder to test bug 34919 when it is fixed

Added Paths:
-----------
    trunk/phase3/tests/phpunit/includes/PreferencesTest.php

Added: trunk/phase3/tests/phpunit/includes/PreferencesTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/PreferencesTest.php                     
        (rev 0)
+++ trunk/phase3/tests/phpunit/includes/PreferencesTest.php     2012-03-05 
11:48:35 UTC (rev 113016)
@@ -0,0 +1,71 @@
+<?php
+
+class PreferencesTest extends MediaWikiTestCase {
+
+       /** Array of User objects */
+       private $users ;
+       private $context ;
+
+       function __construct() {
+               parent::__construct();
+
+               $this->users['noemail'] = new User;
+
+               $this->users['notauth'] = new User;
+               $this->users['notauth']
+                       ->setEmail( '[email protected]' );
+
+               $this->users['auth']    = new User;
+               $this->users['auth']
+                       ->setEmail( '[email protected]' );
+               $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;
+       }
+
+}


Property changes on: trunk/phase3/tests/phpunit/includes/PreferencesTest.php
___________________________________________________________________
Added: svn:eol-style
   + native


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to