Merge "Make LinksUpdate run without a db transaction."
[lhc/web/wiklou.git] / tests / selenium / installer / MediaWikiErrorsNamepageTestCase.php
1 <?php
2
3 /**
4 * MediaWikiErrorsNamepageTestCase
5 *
6 * @file
7 * @ingroup Maintenance
8 * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
9 * http://www.calcey.com/
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * http://www.gnu.org/copyleft/gpl.html
25 *
26 * @addtogroup Maintenance
27 *
28 */
29
30 /**
31 * Test Case ID : 10 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
32 * Test Case Name : Invalid/ blank values for fields in 'Name' page.
33 * Version : MediaWiki 1.18alpha
34 */
35
36 require_once ( __DIR__ . '/MediaWikiInstallationCommonFunction.php' );
37
38 class MediaWikiErrorsNamepageTestCase extends MediaWikiInstallationCommonFunction {
39
40 function setUp() {
41 parent::setUp();
42 }
43
44 // Verify warning message for the 'Name' page
45 public function testErrorsNamePage() {
46
47 $databaseName = DB_NAME_PREFIX."_error_name";
48
49 parent::navigateNamePage( $databaseName );
50
51 // Verify warning message for all blank fields
52 parent::clickContinueButton();
53 $this->assertEquals( "Enter a site name.",
54 $this->getText( LINK_DIV."div[2]/div[2]" ));
55 $this->assertEquals( "Enter an administrator username.",
56 $this->getText( LINK_DIV."div[3]/div[2]" ));
57 $this->assertEquals( "Enter a password for the administrator account.",
58 $this->getText( LINK_DIV."div[4]/div[2]" ));
59
60 // Verify warning message for the blank 'Site name'
61 $this->type( "config__AdminName", VALID_YOUR_NAME );
62 $this->type( "config__AdminPassword", VALID_PASSWORD );
63 $this->type( "config__AdminPassword2", VALID_PASSWORD_AGAIN );
64 parent::clickContinueButton();
65 $this->assertEquals( "Enter a site name.",
66 $this->getText( LINK_DIV."div[2]/div[2]" ));
67
68 // Input valid 'Site name'
69 $this->type( "config_wgSitename", VALID_WIKI_NAME );
70
71
72 // Verify warning message for the invalid "Project namespace'
73 $this->click( "config__NamespaceType_other" );
74 $this->type( "config_wgMetaNamespace", INVALID_NAMESPACE );
75 parent::clickContinueButton();
76 $this->assertEquals( "The specified namespace \"\" is invalid. Specify a different project namespace.",
77 $this->getText( LINK_DIV."div[2]/div[2]" ));
78
79
80 // Verify warning message for the blank 'Project namespace'
81 $this->type( "config_wgSitename", VALID_WIKI_NAME );
82 $this->click( "config__NamespaceType_other" );
83 $this->type( "config_wgMetaNamespace" , "" );
84 parent::clickContinueButton();
85 $this->assertEquals( "The specified namespace \"\" is invalid. Specify a different project namespace.",
86 $this->getText( LINK_DIV."div[2]/div[2]" ));
87
88
89 // Valid 'Project namespace'
90 $this->click( "config__NamespaceType_other" );
91 $this->type( "config_wgMetaNamespace", VALID_NAMESPACE );
92 parent::clickContinueButton();
93
94
95 // Valid 'Site name'
96 $this->click( "config__NamespaceType_site-name" );
97 $this->type( "config_wgSitename", VALID_WIKI_NAME );
98
99
100 // Verify warning message for blank 'Your name'
101 $this->type( "config__AdminName", " " );
102 parent::clickContinueButton();
103 $this->assertEquals( "Enter an administrator username.",
104 $this->getText( LINK_DIV."div[2]/div[2]" ));
105
106 $this->type( "config_wgSitename", VALID_WIKI_NAME );
107 // Verify warning message for blank 'Password'
108 $this->type( "config__AdminName", VALID_YOUR_NAME );
109 $this->type( "config__AdminPassword", " " );
110 parent::clickContinueButton();
111 $this->assertEquals( "Enter a password for the administrator account.",
112 $this->getText( LINK_DIV."div[2]/div[2]" ));
113
114
115 // Verify warning message for the blank 'Password again'
116 $this->type( "config_wgSitename", VALID_WIKI_NAME );
117 $this->type( "config__AdminPassword", VALID_PASSWORD );
118 $this->type( "config__AdminPassword2", " " );
119 parent::clickContinueButton();
120 $this->assertEquals( "The two passwords you entered do not match.",
121 $this->getText( LINK_DIV."div[2]/div[2]" ));
122
123
124 // Verify warning message for the different'Password' and 'Password again'
125 $this->type( "config_wgSitename", VALID_WIKI_NAME );
126 $this->type( "config__AdminPassword", VALID_PASSWORD );
127 $this->type( "config__AdminPassword2", INVALID_PASSWORD_AGAIN );
128 parent::clickContinueButton();
129 $this->assertEquals( "The two passwords you entered do not match.",
130 $this->getText( LINK_DIV."div[2]/div[2]" ));
131 }
132 }