MediaWiki  REL1_19
MediaWikiRestartInstallationTestCase.php
Go to the documentation of this file.
00001 <?php
00002 
00032 require_once (dirname(__FILE__).'/'.'MediaWikiInstallationCommonFunction.php');
00033 
00040 class MediaWikiRestartInstallationTestCase extends MediaWikiInstallationCommonFunction {
00041 
00042     function setUp() {
00043         parent::setUp();
00044     }
00045 
00046     // Verify restarting the installation
00047     public function testSuccessRestartInstallation() {
00048 
00049         $dbNameBeforeRestart  = DB_NAME_PREFIX."_db_before";
00050         parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart );
00051 
00052         // Verify 'Restart installation' link available
00053         $this->assertTrue($this->isElementPresent( "link=Restart installation" ));
00054 
00055         // Click 'Restart installation'
00056         $this->click( "link=Restart installation ");
00057         $this->waitForPageToLoad( PAGE_LOAD_TIME );
00058 
00059         // 'Restart Installation' page displayed
00060         $this->assertEquals( "Restart installation", $this->getText( LINK_DIV."h2"));
00061 
00062         // Restart warning message displayed
00063         $this->assertTrue($this->isTextPresent( "exact:Do you want to clear all saved data that you have entered and restart the installation process?" ));
00064 
00065         // Click on the 'Yes, restart' button
00066         $this->click( "submit-restart" );
00067         $this->waitForPageToLoad( PAGE_LOAD_TIME );
00068 
00069         // Navigate to the initial installation page(Language).
00070         $this->assertEquals(  "Language", $this->getText( LINK_DIV."h2" ));
00071 
00072         // 'Welcome to MediaWiki!' page
00073         parent::clickContinueButton();
00074 
00075         // 'Connect to database' page
00076         parent::clickContinueButton();
00077 
00078         // saved data should be deleted
00079         $dbNameAfterRestart = $this->getValue("mysql_wgDBname");
00080         $this->assertNotEquals($dbNameBeforeRestart, $dbNameAfterRestart);
00081     }
00082 
00083 
00084     // Verify cancelling restart
00085     public function testCancelRestartInstallation() {
00086 
00087         $dbNameBeforeRestart  = DB_NAME_PREFIX."_cancel_restart";
00088 
00089         parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart);
00090         // Verify 'Restart installation' link available
00091         $this->assertTrue($this->isElementPresent( "link=Restart installation" ));
00092 
00093         $this->click( "link=Restart installation" );
00094         $this->waitForPageToLoad( PAGE_LOAD_TIME );
00095 
00096         // 'Restart Installation' page displayed
00097         $this->assertEquals( "Restart installation", $this->getText( LINK_DIV."h2" ));
00098 
00099         // Restart warning message displayed
00100         $this->assertTrue( $this->isTextPresent( "Do you want to clear all saved data that you have entered and restart the installation process?"));
00101 
00102         // Click on the 'Back' button
00103         parent::clickBackButton();
00104 
00105         // Navigates to the previous page
00106         $this->assertEquals( "Database settings", $this->getText( LINK_DIV."h2" ));
00107 
00108         // 'Connect to database' page
00109         parent::clickBackButton();
00110 
00111         // Saved data remain on the page.
00112         $dbNameAfterRestart = $this->getValue( "mysql_wgDBname" );
00113         $this->assertEquals( $dbNameBeforeRestart, $dbNameAfterRestart );
00114     }
00115 }