tests: mock parser tests file access
[mediawiki.git] / tests / selenium / installer / MediaWikiRestartInstallationTestCase.php
blobf34210cba2faaf95b05ce8998d08e1d27d66046d
1 <?php
2 /**
3 * MediaWikiRestartInstallationTestCase
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 : 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
33 class MediaWikiRestartInstallationTestCase extends MediaWikiInstallationCommonFunction {
34 function setUp() {
35 parent::setUp();
38 // Verify restarting the installation
39 public function testSuccessRestartInstallation() {
40 $dbNameBeforeRestart = DB_NAME_PREFIX . "_db_before";
41 parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart );
43 // Verify 'Restart installation' link available
44 $this->assertTrue( $this->isElementPresent( "link=Restart installation" ) );
46 // Click 'Restart installation'
47 $this->click( "link=Restart installation " );
48 $this->waitForPageToLoad( PAGE_LOAD_TIME );
50 // 'Restart Installation' page displayed
51 $this->assertEquals( "Restart installation", $this->getText( LINK_DIV . "h2" ) );
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?" ) );
56 // Click on the 'Yes, restart' button
57 $this->click( "submit-restart" );
58 $this->waitForPageToLoad( PAGE_LOAD_TIME );
60 // Navigate to the initial installation page(Language).
61 $this->assertEquals( "Language", $this->getText( LINK_DIV . "h2" ) );
63 // 'Welcome to MediaWiki!' page
64 parent::clickContinueButton();
66 // 'Connect to database' page
67 parent::clickContinueButton();
69 // saved data should be deleted
70 $dbNameAfterRestart = $this->getValue( "mysql_wgDBname" );
71 $this->assertNotEquals( $dbNameBeforeRestart, $dbNameAfterRestart );
74 // Verify cancelling restart
75 public function testCancelRestartInstallation() {
76 $dbNameBeforeRestart = DB_NAME_PREFIX . "_cancel_restart";
78 parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart );
79 // Verify 'Restart installation' link available
80 $this->assertTrue( $this->isElementPresent( "link=Restart installation" ) );
82 $this->click( "link=Restart installation" );
83 $this->waitForPageToLoad( PAGE_LOAD_TIME );
85 // 'Restart Installation' page displayed
86 $this->assertEquals( "Restart installation", $this->getText( LINK_DIV . "h2" ) );
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?" ) );
91 // Click on the 'Back' button
92 parent::clickBackButton();
94 // Navigates to the previous page
95 $this->assertEquals( "Database settings", $this->getText( LINK_DIV . "h2" ) );
97 // 'Connect to database' page
98 parent::clickBackButton();
100 // Saved data remain on the page.
101 $dbNameAfterRestart = $this->getValue( "mysql_wgDBname" );
102 $this->assertEquals( $dbNameBeforeRestart, $dbNameAfterRestart );