4 * MediaWikiErrorsNamepageTestCase
8 * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
9 * http://www.calcey.com/
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.
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.
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
26 * @addtogroup Maintenance
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
36 require_once ( __DIR__
. '/MediaWikiInstallationCommonFunction.php' );
38 class MediaWikiErrorsNamepageTestCase
extends MediaWikiInstallationCommonFunction
{
43 // Verify warning message for the 'Name' page
44 public function testErrorsNamePage() {
46 $databaseName = DB_NAME_PREFIX
. "_error_name";
48 parent
::navigateNamePage( $databaseName );
50 // Verify warning message for all blank fields
51 parent
::clickContinueButton();
52 $this->assertEquals( "Enter a site name.",
53 $this->getText( LINK_DIV
. "div[2]/div[2]" ) );
54 $this->assertEquals( "Enter an administrator username.",
55 $this->getText( LINK_DIV
. "div[3]/div[2]" ) );
56 $this->assertEquals( "Enter a password for the administrator account.",
57 $this->getText( LINK_DIV
. "div[4]/div[2]" ) );
59 // Verify warning message for the blank 'Site name'
60 $this->type( "config__AdminName", VALID_YOUR_NAME
);
61 $this->type( "config__AdminPassword", VALID_PASSWORD
);
62 $this->type( "config__AdminPassword2", VALID_PASSWORD_AGAIN
);
63 parent
::clickContinueButton();
64 $this->assertEquals( "Enter a site name.",
65 $this->getText( LINK_DIV
. "div[2]/div[2]" ) );
67 // Input valid 'Site name'
68 $this->type( "config_wgSitename", VALID_WIKI_NAME
);
70 // Verify warning message for the invalid "Project namespace'
71 $this->click( "config__NamespaceType_other" );
72 $this->type( "config_wgMetaNamespace", INVALID_NAMESPACE
);
73 parent
::clickContinueButton();
74 $this->assertEquals( "The specified namespace \"\" is invalid. Specify a different project namespace.",
75 $this->getText( LINK_DIV
. "div[2]/div[2]" ) );
77 // Verify warning message for the blank 'Project namespace'
78 $this->type( "config_wgSitename", VALID_WIKI_NAME
);
79 $this->click( "config__NamespaceType_other" );
80 $this->type( "config_wgMetaNamespace", "" );
81 parent
::clickContinueButton();
82 $this->assertEquals( "The specified namespace \"\" is invalid. Specify a different project namespace.",
83 $this->getText( LINK_DIV
. "div[2]/div[2]" ) );
85 // Valid 'Project namespace'
86 $this->click( "config__NamespaceType_other" );
87 $this->type( "config_wgMetaNamespace", VALID_NAMESPACE
);
88 parent
::clickContinueButton();
91 $this->click( "config__NamespaceType_site-name" );
92 $this->type( "config_wgSitename", VALID_WIKI_NAME
);
94 // Verify warning message for blank 'Your name'
95 $this->type( "config__AdminName", " " );
96 parent
::clickContinueButton();
97 $this->assertEquals( "Enter an administrator username.",
98 $this->getText( LINK_DIV
. "div[2]/div[2]" ) );
100 $this->type( "config_wgSitename", VALID_WIKI_NAME
);
101 // Verify warning message for blank 'Password'
102 $this->type( "config__AdminName", VALID_YOUR_NAME
);
103 $this->type( "config__AdminPassword", " " );
104 parent
::clickContinueButton();
105 $this->assertEquals( "Enter a password for the administrator account.",
106 $this->getText( LINK_DIV
. "div[2]/div[2]" ) );
108 // Verify warning message for the blank 'Password again'
109 $this->type( "config_wgSitename", VALID_WIKI_NAME
);
110 $this->type( "config__AdminPassword", VALID_PASSWORD
);
111 $this->type( "config__AdminPassword2", " " );
112 parent
::clickContinueButton();
113 $this->assertEquals( "The two passwords you entered do not match.",
114 $this->getText( LINK_DIV
. "div[2]/div[2]" ) );
116 // Verify warning message for the different'Password' and 'Password again'
117 $this->type( "config_wgSitename", VALID_WIKI_NAME
);
118 $this->type( "config__AdminPassword", VALID_PASSWORD
);
119 $this->type( "config__AdminPassword2", INVALID_PASSWORD_AGAIN
);
120 parent
::clickContinueButton();
121 $this->assertEquals( "The two passwords you entered do not match.",
122 $this->getText( LINK_DIV
. "div[2]/div[2]" ) );