b9ca83057facebb6e7ad38a6b2096aa5ee62bb81
[lhc/web/wiklou.git] / tests / selenium / installer / MediaWikiRestartInstallationTestCase.php
1 <?php
2
3 /**
4 * MediaWikiRestartInstallationTestCase
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
32 require_once (dirname(__FILE__).'/'.'MediaWikiInstallationCommonFunction.php');
33
34 /**
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
38 */
39
40 class MediaWikiRestartInstallationTestCase extends MediaWikiInstallationCommonFunction {
41
42 function setUp() {
43 parent::setUp();
44 }
45
46 // Verify restarting the installation
47 public function testSuccessRestartInstallation() {
48
49 $dbNameBeforeRestart = DB_NAME_PREFIX."_db_before";
50 parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart );
51
52 // Verify 'Restart installation' link available
53 $this->assertTrue($this->isElementPresent( "link=Restart installation" ));
54
55 // Click 'Restart installation'
56 $this->click( "link=Restart installation ");
57 $this->waitForPageToLoad( PAGE_LOAD_TIME );
58
59 // 'Restart Installation' page displayed
60 $this->assertEquals( "Restart installation", $this->getText( LINK_DIV."h2"));
61
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?" ));
64
65 // Click on the 'Yes, restart' button
66 $this->click( "submit-restart" );
67 $this->waitForPageToLoad( PAGE_LOAD_TIME );
68
69 // Navigate to the initial installation page(Language).
70 $this->assertEquals( "Language", $this->getText( LINK_DIV."h2" ));
71
72 // 'Welcome to MediaWiki!' page
73 parent::clickContinueButton();
74
75 // 'Connect to database' page
76 parent::clickContinueButton();
77
78 // saved data should be deleted
79 $dbNameAfterRestart = $this->getValue("mysql_wgDBname");
80 $this->assertNotEquals($dbNameBeforeRestart, $dbNameAfterRestart);
81 }
82
83
84 // Verify cancelling restart
85 public function testCancelRestartInstallation() {
86
87 $dbNameBeforeRestart = DB_NAME_PREFIX."_cancel_restart";
88
89 parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart);
90 // Verify 'Restart installation' link available
91 $this->assertTrue($this->isElementPresent( "link=Restart installation" ));
92
93 $this->click( "link=Restart installation" );
94 $this->waitForPageToLoad( PAGE_LOAD_TIME );
95
96 // 'Restart Installation' page displayed
97 $this->assertEquals( "Restart installation", $this->getText( LINK_DIV."h2" ));
98
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?"));
101
102 // Click on the 'Back' button
103 parent::clickBackButton();
104
105 // Navigates to the previous page
106 $this->assertEquals( "Database settings", $this->getText( LINK_DIV."h2" ));
107
108 // 'Connect to database' page
109 parent::clickBackButton();
110
111 // Saved data remain on the page.
112 $dbNameAfterRestart = $this->getValue( "mysql_wgDBname" );
113 $this->assertEquals( $dbNameBeforeRestart, $dbNameAfterRestart );
114 }
115 }