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