MediaWiki  REL1_21
MediaWikiErrorsNamepageTestCase.php
Go to the documentation of this file.
00001 <?php
00026 require_once ( __DIR__ . '/MediaWikiInstallationCommonFunction.php' );
00027 
00033 class MediaWikiErrorsNamepageTestCase extends MediaWikiInstallationCommonFunction {
00034         function setUp() {
00035                 parent::setUp();
00036         }
00037 
00038         // Verify warning message for the 'Name' page
00039         public function testErrorsNamePage() {
00040 
00041                 $databaseName = DB_NAME_PREFIX . "_error_name";
00042 
00043                 parent::navigateNamePage( $databaseName );
00044 
00045                 // Verify warning message for all blank fields
00046                 parent::clickContinueButton();
00047                 $this->assertEquals( "Enter a site name.",
00048                         $this->getText( LINK_DIV . "div[2]/div[2]" ) );
00049                 $this->assertEquals( "Enter an administrator username.",
00050                         $this->getText( LINK_DIV . "div[3]/div[2]" ) );
00051                 $this->assertEquals( "Enter a password for the administrator account.",
00052                         $this->getText( LINK_DIV . "div[4]/div[2]" ) );
00053 
00054                 // Verify warning message for the blank 'Site name'
00055                 $this->type( "config__AdminName", VALID_YOUR_NAME );
00056                 $this->type( "config__AdminPassword", VALID_PASSWORD );
00057                 $this->type( "config__AdminPassword2", VALID_PASSWORD_AGAIN );
00058                 parent::clickContinueButton();
00059                 $this->assertEquals( "Enter a site name.",
00060                         $this->getText( LINK_DIV . "div[2]/div[2]" ) );
00061 
00062                 // Input valid 'Site name'
00063                 $this->type( "config_wgSitename", VALID_WIKI_NAME );
00064 
00065                 // Verify warning message for the invalid "Project namespace'
00066                 $this->click( "config__NamespaceType_other" );
00067                 $this->type( "config_wgMetaNamespace", INVALID_NAMESPACE );
00068                 parent::clickContinueButton();
00069                 $this->assertEquals( "The specified namespace \"\" is invalid. Specify a different project namespace.",
00070                         $this->getText( LINK_DIV . "div[2]/div[2]" ) );
00071 
00072                 // Verify warning message for the blank 'Project namespace'
00073                 $this->type( "config_wgSitename", VALID_WIKI_NAME );
00074                 $this->click( "config__NamespaceType_other" );
00075                 $this->type( "config_wgMetaNamespace", "" );
00076                 parent::clickContinueButton();
00077                 $this->assertEquals( "The specified namespace \"\" is invalid. Specify a different project namespace.",
00078                         $this->getText( LINK_DIV . "div[2]/div[2]" ) );
00079 
00080                 // Valid 'Project namespace'
00081                 $this->click( "config__NamespaceType_other" );
00082                 $this->type( "config_wgMetaNamespace", VALID_NAMESPACE );
00083                 parent::clickContinueButton();
00084 
00085                 // Valid 'Site name'
00086                 $this->click( "config__NamespaceType_site-name" );
00087                 $this->type( "config_wgSitename", VALID_WIKI_NAME );
00088 
00089                 // Verify warning message for blank 'Your name'
00090                 $this->type( "config__AdminName", " " );
00091                 parent::clickContinueButton();
00092                 $this->assertEquals( "Enter an administrator username.",
00093                         $this->getText( LINK_DIV . "div[2]/div[2]" ) );
00094 
00095                 $this->type( "config_wgSitename", VALID_WIKI_NAME );
00096                 // Verify warning message for blank 'Password'
00097                 $this->type( "config__AdminName", VALID_YOUR_NAME );
00098                 $this->type( "config__AdminPassword", " " );
00099                 parent::clickContinueButton();
00100                 $this->assertEquals( "Enter a password for the administrator account.",
00101                         $this->getText( LINK_DIV . "div[2]/div[2]" ) );
00102 
00103                 // Verify warning message for the blank 'Password again'
00104                 $this->type( "config_wgSitename", VALID_WIKI_NAME );
00105                 $this->type( "config__AdminPassword", VALID_PASSWORD );
00106                 $this->type( "config__AdminPassword2", " " );
00107                 parent::clickContinueButton();
00108                 $this->assertEquals( "The two passwords you entered do not match.",
00109                         $this->getText( LINK_DIV . "div[2]/div[2]" ) );
00110 
00111                 // Verify warning message for the different'Password' and 'Password again'
00112                 $this->type( "config_wgSitename", VALID_WIKI_NAME );
00113                 $this->type( "config__AdminPassword", VALID_PASSWORD );
00114                 $this->type( "config__AdminPassword2", INVALID_PASSWORD_AGAIN );
00115                 parent::clickContinueButton();
00116                 $this->assertEquals( "The two passwords you entered do not match.",
00117                         $this->getText( LINK_DIV . "div[2]/div[2]" ) );
00118         }
00119 }