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