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