Merge "Various code and doc cleanups to ChronologyProtector."
[mediawiki.git] / tests / selenium / installer / MediaWikiUpgradeExistingDatabaseTestCase.php
blobcd901d186fde9b6468a553322f85f70147e733b9
1 <?php
2 /**
3 * MediaWikiUpgradeExistingDatabaseTestCase
5 * @file
6 * @ingroup Maintenance
7 * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
8 * http://www.calcey.com/
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.
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.
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
26 require_once ( __DIR__ . '/MediaWikiInstallationCommonFunction.php' );
28 /**
29 * Test Case ID : 05 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
30 * Test Case Name : Install Mediawiki by updating the existing database.
31 * Version : MediaWiki 1.18alpha
33 class MediaWikiUpgradeExistingDatabaseTestCase extends MediaWikiInstallationCommonFunction {
34 function setUp() {
35 parent::setUp();
38 // Install Mediawiki using 'MySQL' database type.
39 public function testUpgradeExistingDatabase() {
41 $databaseName = DB_NAME_PREFIX . "_upgrade_existing";
42 parent::navigateInstallPage( $databaseName );
44 $this->open( "http://localhost:" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
45 $this->assertEquals( "Install", $this->getText( LINK_DIV . "h2" ) );
46 $this->assertEquals(
47 "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
48 $this->getText( LINK_DIV . "div[2]/form/div[1]/div[2]" )
51 // 'Optionis' page
52 parent::clickBackButton();
54 // 'Name' page
55 parent::clickBackButton();
57 // 'Database settings' page
58 parent::clickBackButton();
60 // 'Connect to database' page
61 parent::clickBackButton();
62 $this->type( "mysql_wgDBname", $databaseName );
63 parent::clickContinueButton();
65 // 'Upgrade existing installation' page displayed next to the 'Connect to database' page.
66 $this->assertEquals( "Upgrade existing installation", $this->getText( LINK_DIV . "h2" ) );
68 // Warning message displayed.
69 $this->assertEquals( "There are MediaWiki tables in this database. To upgrade them to MediaWiki 1.18alpha, click Continue.",
70 $this->getText( LINK_DIV . "div[2]/form/div[1]/div[2]" ) );
72 parent::clickContinueButton();
73 $this->assertEquals( "Upgrade existing installation",
74 $this->getText( LINK_DIV . "h2" ) );
76 // 'Upgrade complete.' text display
77 $this->assertEquals( "Upgrade complete.",
78 $this->getText( "//div[@id='bodyContent']/div/div[1]/div[4]/form/div[1]/div[2]/p[1]" ) );
80 $this->assertEquals( "You can now Folder/index.php start using your wiki.",
81 $this->getText( "//div[@id='bodyContent']/div/div[1]/div[4]/form/div[1]/div[2]/p[2]" ) );
83 $this->assertEquals( "Folder/index.php start using your wiki",
84 $this->getText( "link=Folder/index.php start using your wiki" ) );
86 $this->assertTrue( $this->isElementPresent( "submit-regenerate" ) );
87 $this->click( "submit-regenerate" );
88 $this->waitForPageToLoad( PAGE_LOAD_TIME );
89 $this->assertEquals( "Database settings",
90 $this->getText( LINK_DIV . "h2" ) );
92 // 'Database settings' page
93 parent::clickContinueButton();
95 // Name page
96 parent::completeNamePage();
98 // Options page
99 parent::clickContinueButton();
101 // Install page
102 $this->assertEquals( "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
103 $this->getText( LINK_FORM . "div[1]/div[2]" ) );
104 parent::clickContinueButton();
106 // complete
107 parent::completePageSuccessfull();
108 $this->chooseCancelOnNextConfirmation();
109 parent::restartInstallation();