4 * MediaWikiRestartInstallationTestCase
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
32 require_once (__DIR__
.'/'.'MediaWikiInstallationCommonFunction.php');
35 * Test Case ID : 11, 12 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
36 * Test Case Name : Install mediawiki on a already installed Mediawiki.
37 * Version : MediaWiki 1.18alpha
40 class MediaWikiRestartInstallationTestCase
extends MediaWikiInstallationCommonFunction
{
46 // Verify restarting the installation
47 public function testSuccessRestartInstallation() {
49 $dbNameBeforeRestart = DB_NAME_PREFIX
."_db_before";
50 parent
::navigateDatabaseSettingsPage( $dbNameBeforeRestart );
52 // Verify 'Restart installation' link available
53 $this->assertTrue($this->isElementPresent( "link=Restart installation" ));
55 // Click 'Restart installation'
56 $this->click( "link=Restart installation ");
57 $this->waitForPageToLoad( PAGE_LOAD_TIME
);
59 // 'Restart Installation' page displayed
60 $this->assertEquals( "Restart installation", $this->getText( LINK_DIV
."h2"));
62 // Restart warning message displayed
63 $this->assertTrue($this->isTextPresent( "exact:Do you want to clear all saved data that you have entered and restart the installation process?" ));
65 // Click on the 'Yes, restart' button
66 $this->click( "submit-restart" );
67 $this->waitForPageToLoad( PAGE_LOAD_TIME
);
69 // Navigate to the initial installation page(Language).
70 $this->assertEquals( "Language", $this->getText( LINK_DIV
."h2" ));
72 // 'Welcome to MediaWiki!' page
73 parent
::clickContinueButton();
75 // 'Connect to database' page
76 parent
::clickContinueButton();
78 // saved data should be deleted
79 $dbNameAfterRestart = $this->getValue("mysql_wgDBname");
80 $this->assertNotEquals($dbNameBeforeRestart, $dbNameAfterRestart);
84 // Verify cancelling restart
85 public function testCancelRestartInstallation() {
87 $dbNameBeforeRestart = DB_NAME_PREFIX
."_cancel_restart";
89 parent
::navigateDatabaseSettingsPage( $dbNameBeforeRestart);
90 // Verify 'Restart installation' link available
91 $this->assertTrue($this->isElementPresent( "link=Restart installation" ));
93 $this->click( "link=Restart installation" );
94 $this->waitForPageToLoad( PAGE_LOAD_TIME
);
96 // 'Restart Installation' page displayed
97 $this->assertEquals( "Restart installation", $this->getText( LINK_DIV
."h2" ));
99 // Restart warning message displayed
100 $this->assertTrue( $this->isTextPresent( "Do you want to clear all saved data that you have entered and restart the installation process?"));
102 // Click on the 'Back' button
103 parent
::clickBackButton();
105 // Navigates to the previous page
106 $this->assertEquals( "Database settings", $this->getText( LINK_DIV
."h2" ));
108 // 'Connect to database' page
109 parent
::clickBackButton();
111 // Saved data remain on the page.
112 $dbNameAfterRestart = $this->getValue( "mysql_wgDBname" );
113 $this->assertEquals( $dbNameBeforeRestart, $dbNameAfterRestart );