phpcs: More require/include is not a function
[lhc/web/wiklou.git] / tests / selenium / installer / MediaWikiUpgradeExistingDatabaseTestCase.php
1 <?php
2 /**
3 * MediaWikiUpgradeExistingDatabaseTestCase
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 : 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
32 */
33 class MediaWikiUpgradeExistingDatabaseTestCase extends MediaWikiInstallationCommonFunction {
34 function setUp() {
35 parent::setUp();
36 }
37
38 // Install Mediawiki using 'MySQL' database type.
39 public function testUpgradeExistingDatabase() {
40
41 $databaseName = DB_NAME_PREFIX . "_upgrade_existing";
42 parent::navigateInstallPage( $databaseName );
43
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]" )
49 );
50
51 // 'Optionis' page
52 parent::clickBackButton();
53
54 // 'Name' page
55 parent::clickBackButton();
56
57 // 'Database settings' page
58 parent::clickBackButton();
59
60 // 'Connect to database' page
61 parent::clickBackButton();
62 $this->type( "mysql_wgDBname", $databaseName );
63 parent::clickContinueButton();
64
65 // 'Upgrade existing installation' page displayed next to the 'Connect to database' page.
66 $this->assertEquals( "Upgrade existing installation", $this->getText( LINK_DIV . "h2" ) );
67
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]" ) );
71
72 parent::clickContinueButton();
73 $this->assertEquals( "Upgrade existing installation",
74 $this->getText( LINK_DIV . "h2" ) );
75
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]" ) );
79
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]" ) );
82
83 $this->assertEquals( "Folder/index.php start using your wiki",
84 $this->getText( "link=Folder/index.php start using your wiki" ) );
85
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" ) );
91
92 // 'Database settings' page
93 parent::clickContinueButton();
94
95 // Name page
96 parent::completeNamePage();
97
98 // Options page
99 parent::clickContinueButton();
100
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();
105
106 // complete
107 parent::completePageSuccessfull();
108 $this->chooseCancelOnNextConfirmation();
109 parent::restartInstallation();
110 }
111 }