MediaWiki  REL1_21
MediaWikiUpgradeExistingDatabaseTestCase.php
Go to the documentation of this file.
00001 <?php
00026 require_once ( __DIR__ . '/MediaWikiInstallationCommonFunction.php' );
00027 
00033 class MediaWikiUpgradeExistingDatabaseTestCase extends MediaWikiInstallationCommonFunction {
00034         function setUp() {
00035                 parent::setUp();
00036         }
00037 
00038         // Install Mediawiki using 'MySQL' database type.
00039         public function testUpgradeExistingDatabase() {
00040 
00041                 $databaseName = DB_NAME_PREFIX . "_upgrade_existing";
00042                 parent::navigateInstallPage( $databaseName );
00043 
00044                 $this->open( "http://localhost:" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
00045                 $this->assertEquals( "Install", $this->getText( LINK_DIV . "h2" ) );
00046                 $this->assertEquals(
00047                         "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
00048                         $this->getText( LINK_DIV . "div[2]/form/div[1]/div[2]" )
00049                 );
00050 
00051                 // 'Optionis' page
00052                 parent::clickBackButton();
00053 
00054                 // 'Name' page
00055                 parent::clickBackButton();
00056 
00057                 // 'Database settings' page
00058                 parent::clickBackButton();
00059 
00060                 // 'Connect to database' page
00061                 parent::clickBackButton();
00062                 $this->type( "mysql_wgDBname", $databaseName );
00063                 parent::clickContinueButton();
00064 
00065                 // 'Upgrade existing installation' page  displayed next to the 'Connect to database' page.
00066                 $this->assertEquals( "Upgrade existing installation", $this->getText( LINK_DIV . "h2" ) );
00067 
00068                 // Warning message displayed.
00069                 $this->assertEquals( "There are MediaWiki tables in this database. To upgrade them to MediaWiki 1.18alpha, click Continue.",
00070                         $this->getText( LINK_DIV . "div[2]/form/div[1]/div[2]" ) );
00071 
00072                 parent::clickContinueButton();
00073                 $this->assertEquals( "Upgrade existing installation",
00074                         $this->getText( LINK_DIV . "h2" ) );
00075 
00076                 // 'Upgrade complete.' text display
00077                 $this->assertEquals( "Upgrade complete.",
00078                         $this->getText( "//div[@id='bodyContent']/div/div[1]/div[4]/form/div[1]/div[2]/p[1]" ) );
00079 
00080                 $this->assertEquals( "You can now Folder/index.php start using your wiki.",
00081                         $this->getText( "//div[@id='bodyContent']/div/div[1]/div[4]/form/div[1]/div[2]/p[2]" ) );
00082 
00083                 $this->assertEquals( "Folder/index.php start using your wiki",
00084                         $this->getText( "link=Folder/index.php start using your wiki" ) );
00085 
00086                 $this->assertTrue( $this->isElementPresent( "submit-regenerate" ) );
00087                 $this->click( "submit-regenerate" );
00088                 $this->waitForPageToLoad( PAGE_LOAD_TIME );
00089                 $this->assertEquals( "Database settings",
00090                         $this->getText( LINK_DIV . "h2" ) );
00091 
00092                 // 'Database settings' page
00093                 parent::clickContinueButton();
00094 
00095                 // Name page
00096                 parent::completeNamePage();
00097 
00098                 // Options page
00099                 parent::clickContinueButton();
00100 
00101                 // Install page
00102                 $this->assertEquals( "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
00103                         $this->getText( LINK_FORM . "div[1]/div[2]" ) );
00104                 parent::clickContinueButton();
00105 
00106                 // complete
00107                 parent::completePageSuccessfull();
00108                 $this->chooseCancelOnNextConfirmation();
00109                 parent::restartInstallation();
00110         }
00111 }