Merge "Revert "Overriding Vector's footer margin when in print mode""
[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 require_once ( __DIR__ . '/' . 'MediaWikiInstallationCommonFunction.php' );
32
33 /**
34 * Test Case ID : 11, 12 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
35 * Test Case Name : Install mediawiki on a already installed Mediawiki.
36 * Version : MediaWiki 1.18alpha
37 */
38
39 class MediaWikiRestartInstallationTestCase extends MediaWikiInstallationCommonFunction {
40 function setUp() {
41 parent::setUp();
42 }
43
44 // Verify restarting the installation
45 public function testSuccessRestartInstallation() {
46 $dbNameBeforeRestart = DB_NAME_PREFIX . "_db_before";
47 parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart );
48
49 // Verify 'Restart installation' link available
50 $this->assertTrue( $this->isElementPresent( "link=Restart installation" ) );
51
52 // Click 'Restart installation'
53 $this->click( "link=Restart installation " );
54 $this->waitForPageToLoad( PAGE_LOAD_TIME );
55
56 // 'Restart Installation' page displayed
57 $this->assertEquals( "Restart installation", $this->getText( LINK_DIV . "h2" ) );
58
59 // Restart warning message displayed
60 $this->assertTrue( $this->isTextPresent( "exact:Do you want to clear all saved data that you have entered and restart the installation process?" ) );
61
62 // Click on the 'Yes, restart' button
63 $this->click( "submit-restart" );
64 $this->waitForPageToLoad( PAGE_LOAD_TIME );
65
66 // Navigate to the initial installation page(Language).
67 $this->assertEquals( "Language", $this->getText( LINK_DIV . "h2" ) );
68
69 // 'Welcome to MediaWiki!' page
70 parent::clickContinueButton();
71
72 // 'Connect to database' page
73 parent::clickContinueButton();
74
75 // saved data should be deleted
76 $dbNameAfterRestart = $this->getValue( "mysql_wgDBname" );
77 $this->assertNotEquals( $dbNameBeforeRestart, $dbNameAfterRestart );
78 }
79
80 // Verify cancelling restart
81 public function testCancelRestartInstallation() {
82 $dbNameBeforeRestart = DB_NAME_PREFIX . "_cancel_restart";
83
84 parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart );
85 // Verify 'Restart installation' link available
86 $this->assertTrue( $this->isElementPresent( "link=Restart installation" ) );
87
88 $this->click( "link=Restart installation" );
89 $this->waitForPageToLoad( PAGE_LOAD_TIME );
90
91 // 'Restart Installation' page displayed
92 $this->assertEquals( "Restart installation", $this->getText( LINK_DIV . "h2" ) );
93
94 // Restart warning message displayed
95 $this->assertTrue( $this->isTextPresent( "Do you want to clear all saved data that you have entered and restart the installation process?" ) );
96
97 // Click on the 'Back' button
98 parent::clickBackButton();
99
100 // Navigates to the previous page
101 $this->assertEquals( "Database settings", $this->getText( LINK_DIV . "h2" ) );
102
103 // 'Connect to database' page
104 parent::clickBackButton();
105
106 // Saved data remain on the page.
107 $dbNameAfterRestart = $this->getValue( "mysql_wgDBname" );
108 $this->assertEquals( $dbNameBeforeRestart, $dbNameAfterRestart );
109 }
110 }