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