Merge "Fix ApiCreateAccountTest for $wgEnableEmail = false;"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 21 Jan 2013 20:36:33 +0000 (20:36 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 21 Jan 2013 20:36:33 +0000 (20:36 +0000)
tests/phpunit/includes/api/ApiAccountCreationTest.php

index 80f41e2..60f6537 100644 (file)
@@ -32,7 +32,7 @@ class ApiCreateAccountTest extends ApiTestCase {
                        'action' => 'createaccount',
                        'name' => 'Apitestnew',
                        'password' => $password,
-                       'email' => 'test@example.com',
+                       'email' => 'test@domain.test',
                        'realname' => 'Test Name'
                ) );
 
@@ -89,6 +89,13 @@ class ApiCreateAccountTest extends ApiTestCase {
                $a = $result['login']['result'];
 
                $this->assertEquals( 'Success', $a );
+
+               // log out to destroy the session
+               $ret = $this->doApiRequest( array(
+                       'action' => 'logout',
+                       ), $ret[2]
+               );
+               $this->assertEquals( array(), $ret[0] );
        }
 
        /**
@@ -134,12 +141,16 @@ class ApiCreateAccountTest extends ApiTestCase {
         * @expectedException UsageException
         */
        function testInvalidEmail() {
+               global $wgEnableEmail;
+               if( !$wgEnableEmail ) {
+                       $this->markTestSkipped( 'email is not enabled, so createaccount does not check it' );
+               }
                $this->doApiRequest( array(
                        'action' => 'createaccount',
                        'name' => 'Test User',
                        'token' => LoginForm::getCreateaccountToken(),
                        'password' => 'password',
-                       'email' => 'sjlfsjklj',
+                       'email' => 'invalid',
                ) );
        }
 }