a661273aa1254032e132eb713e6ea14a17053603
[lhc/web/wiklou.git] / tests / installer / MediaWikiUpgradeExistingDatabaseTestCase.php
1 <?php
2
3 /**
4 * MediaWikiUpgradeExistingDatabaseTestCase
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( str_replace('//','/',dirname(__FILE__).'/') .'MediaWikiInstallationCommonFunction.php');
32
33 /*
34 * Test Case ID : 05 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
35 * Test Case Name : Install Mediawiki by updating the existing database.
36 * Version : MediaWiki 1.18alpha
37 */
38
39
40 class MediaWikiUpgradeExistingDatabaseTestCase extends MediaWikiInstallationCommonFunction {
41
42 function setUp() {
43 parent::setUp();
44 }
45
46 // Install Mediawiki using 'MySQL' database type.
47 public function testUpgradeExistingDatabase() {
48
49 $databaseName = DB_NAME_PREFIX."_upgrade_existing";
50 parent::navigateInstallPage( $databaseName );
51
52 $this->open( "http://localhost:".PORT."/".DIRECTORY_NAME."/config/index.php" );
53 $this->assertEquals( "Install", $this->getText( "//div[@id='bodyContent']/div/div/h2" ));
54 $this->assertEquals( "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
55 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]" ));
56
57 // 'Optionis' page
58 parent::clickBackButton();
59
60 // 'Name' page
61 parent::clickBackButton();
62
63 // 'Database settings' page
64 parent::clickBackButton();
65
66 // 'Connect to database' page
67 parent::clickBackButton();
68 $this->type( "mysql_wgDBname", $databaseName );
69 parent::clickContinueButton();
70
71 // 'Upgrade existing installation' page displayed next to the 'Connect to database' page.
72 $this->assertEquals( "Upgrade existing installation", $this->getText( "//div[@id='bodyContent']/div/div/h2" ));
73
74 // Warning message displayed.
75 $this->assertEquals( "There are MediaWiki tables in this database. To upgrade them to MediaWiki 1.18alpha, click Continue.",
76 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]" ));
77
78 parent::clickContinueButton();
79 $this->assertEquals( "Upgrade existing installation",
80 $this->getText( "//div[@id='bodyContent']/div/div/h2" ));
81
82 // 'Upgrade complete.' text display
83 $this->assertEquals("Upgrade complete.",
84 $this->getText("//div[@id='bodyContent']/div/div/div[4]/form/div[1]/div[2]/p[1]"));
85 $this->assertEquals("You can now start using your wiki.",
86 $this->getText("//div[@id='bodyContent']/div/div/div[4]/form/div[1]/div[2]/p[2]"));
87
88 $this->assertTrue($this->isElementPresent( "submit-regenerate" ));
89 $this->click( "submit-regenerate" );
90 $this->waitForPageToLoad( PAGE_LOAD_TIME );
91 $this->assertEquals( "Database settings",
92 $this->getText( "//div[@id='bodyContent']/div/div/h2" ));
93
94 // 'Database settings' page
95 parent::clickContinueButton();
96
97 // Name page
98 parent::completeNamePage();
99
100 // Options page
101 parent::clickContinueButton();
102
103 // Install page
104 $this->assertEquals( "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
105 $this->getText( "//div[@id='bodyContent']/div/div/div[2]/form/div[1]/div[2]" ));
106 parent::clickContinueButton();
107
108 // complete
109 parent::completePageSuccessfull();
110 $this->chooseCancelOnNextConfirmation();
111 parent::restartInstallation();
112 }
113 }