eb82071e5c9556139350d56cfbed5aa0a60d9ea6
[lhc/web/wiklou.git] / tests / selenium / 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 (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( LINK_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( LINK_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( LINK_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( LINK_DIV."div[2]/form/div[1]/div[2]" ));
77
78 parent::clickContinueButton();
79 $this->assertEquals( "Upgrade existing installation",
80 $this->getText( LINK_DIV."h2" ));
81
82 // 'Upgrade complete.' text display
83 $this->assertEquals("Upgrade complete.",
84 $this->getText("//div[@id='bodyContent']/div/div[1]/div[4]/form/div[1]/div[2]/p[1]"));
85
86 $this->assertEquals("You can now Folder/index.php start using your wiki.",
87 $this->getText("//div[@id='bodyContent']/div/div[1]/div[4]/form/div[1]/div[2]/p[2]" ));
88
89 $this->assertEquals( "Folder/index.php start using your wiki",
90 $this->getText( "link=Folder/index.php start using your wiki" ));
91
92 $this->assertTrue($this->isElementPresent( "submit-regenerate" ));
93 $this->click( "submit-regenerate" );
94 $this->waitForPageToLoad( PAGE_LOAD_TIME );
95 $this->assertEquals( "Database settings",
96 $this->getText( LINK_DIV."h2" ));
97
98 // 'Database settings' page
99 parent::clickContinueButton();
100
101 // Name page
102 parent::completeNamePage();
103
104 // Options page
105 parent::clickContinueButton();
106
107 // Install page
108 $this->assertEquals( "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
109 $this->getText( LINK_FORM."div[1]/div[2]" ));
110 parent::clickContinueButton();
111
112 // complete
113 parent::completePageSuccessfull();
114 $this->chooseCancelOnNextConfirmation();
115 parent::restartInstallation();
116 }
117 }