Style code

* Fix errors and warnings from phpcs.
* Add commas at end of lines for arrays in PHP.
* Add space between // and comment.
* Add space between ) and {.
* Use tabs instead of spaces for indenting.
* Break lines in PHP with more than 100 characters.
* Remove double spaces and spaces at end of line.
* Remove spaces before comma.
* Fix some typos.

Change-Id: I9c014bdfa9832fa6a20d0190fe2fc668983d0fb9
This commit is contained in:
Fomafix 2015-03-14 15:49:04 +00:00 committed by [[mw:User:Fomafix]]
parent f691fbb8f2
commit d16dfb0ad5
11 changed files with 134 additions and 113 deletions

View file

@ -122,7 +122,8 @@ class WikiEditorHooks {
if ( !isset( $wgWikiEditorFeatures[$name] ) || $wgWikiEditorFeatures[$name]['global'] ) {
return true;
}
// Features with user preference control can have any number of preferences to be specific values to be enabled
// Features with user preference control can have any number of preferences
// to be specific values to be enabled
if ( $wgWikiEditorFeatures[$name]['user'] ) {
if ( isset( self::$features[$name]['requirements'] ) ) {
foreach ( self::$features[$name]['requirements'] as $requirement => $value ) {
@ -134,7 +135,8 @@ class WikiEditorHooks {
}
return true;
}
// Features controlled by $wgWikiEditorFeatures with both global and user set to false are awlways disabled
// Features controlled by $wgWikiEditorFeatures with both global and user
// set to false are always disabled
return false;
}
@ -346,7 +348,8 @@ class WikiEditorHooks {
*
* Registers JavaScript test modules
*
* @param $testModules array of javascript testing modules. 'qunit' is fed using tests/qunit/QUnitTestResources.php.
* @param $testModules array of javascript testing modules. 'qunit' is fed using
* tests/qunit/QUnitTestResources.php.
* @param $resourceLoader object
* @return bool
*/

View file

@ -152,7 +152,7 @@ $GLOBALS['wgResourceModules'] += array(
'jquery.wikiEditor',
'jquery.wikiEditor.toolbar.i18n',
'jquery.wikiEditor.toolbar',
)
),
),
'jquery.wikiEditor.toolbar.i18n' => $wikiEditorTpl + array(
'messages' => array(
@ -415,7 +415,7 @@ $GLOBALS['wgResourceModules'] += array(
'ext.wikiEditor',
'jquery.wikiEditor.toolbar',
'jquery.wikiEditor.toolbar.config',
)
),
),
'ext.wikiEditor.toolbar.styles' => $wikiEditorTpl + array(
'styles' => 'ext.wikiEditor.toolbar.styles.less',

View file

@ -0,0 +1,68 @@
<?php
require_once 'WikiDialogsLinksSetup.php';
/**
* Description of WikiNewPageDialogs
*
* @author bhagyag, pdhanda
*
* This test case is part of the WikiEditorTestSuite.
* Configuration for these tests are documented as part of
* extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php
*
*/
class WikiDialogsLinks extends WikiDialogsLinksSetup {
// Set up the testing environment
function setup() {
parent::setUp();
parent::doCreateInternalTestPageIfMissing();
}
function tearDown() {
parent::doLogout();
parent::tearDown();
}
// Create a new page temporary
function createNewPage() {
parent::doOpenLink();
parent::login();
parent::doCreateNewPageTemporary();
}
// Add a internal link and verify
function testInternalLink() {
$this->createNewPage();
parent::verifyInternalLink();
}
// Add a internal link with different display text and verify
function testInternalLinkWithDisplayText() {
$this->createNewPage();
parent::verifyInternalLinkWithDisplayText();
}
// Add a internal link with blank display text and verify
function testInternalLinkWithBlankDisplayText() {
$this->createNewPage();
parent::verifyInternalLinkWithBlankDisplayText();
}
// Add external link and verify
function testExternalLink() {
$this->createNewPage();
parent::verifyExternalLink();
}
// Add external link with different display text and verify
function testExternalLinkWithDisplayText( ) {
$this->createNewPage();
parent::verifyExternalLinkWithDisplayText();
}
// Add external link with Blank display text and verify
function testExternalLinkWithBlankDisplayText() {
$this->createNewPage();
parent::verifyExternalLinkWithBlankDisplayText();
}
}

View file

@ -5,7 +5,7 @@ include( "WikiEditorConstants.php" );
* Date : Apr - 2010
* @author : BhagyaG - Calcey
*/
class WikiDialogs_Links_Setup extends SeleniumTestCase {
class WikiDialogsLinksSetup extends SeleniumTestCase {
// Open the page.
function doOpenLink() {
@ -64,15 +64,24 @@ class WikiDialogs_Links_Setup extends SeleniumTestCase {
$this->click( LINK_ADDLINK );
$this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME );
$this->type( TEXT_LINKNAME, ( WIKI_INTERNAL_LINK ) );
$this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ), 'Element ' . ICON_PAGEEXISTS . 'Not found' );
$this->assertTrue(
$this->isElementPresent( ICON_PAGEEXISTS ),
'Element ' . ICON_PAGEEXISTS . 'Not found'
);
$this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) );
$this->click( BUTTON_INSERTLINK );
$this->click( LINK_PREVIEW );
$this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
$this->assertEquals( ( WIKI_INTERNAL_LINK ), $this->getText( LINK_START . WIKI_INTERNAL_LINK ) );
$this->assertEquals(
( WIKI_INTERNAL_LINK ),
$this->getText( LINK_START . WIKI_INTERNAL_LINK )
);
$this->click( LINK_START . WIKI_INTERNAL_LINK );
$this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
$this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText( TEXT_PAGE_HEADING ) );
$this->assertTrue(
$this->isTextPresent( WIKI_INTERNAL_LINK ),
$this->getText( TEXT_PAGE_HEADING )
);
}
// Add a internal link with different display text and verify
@ -81,7 +90,8 @@ class WikiDialogs_Links_Setup extends SeleniumTestCase {
$this->click( LINK_ADDLINK );
$this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME );
$this->type( TEXT_LINKNAME, WIKI_INTERNAL_LINK );
$this->type ( TEXT_LINKDISPLAYNAME, WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT );
$this->type( TEXT_LINKDISPLAYNAME,
WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT );
$this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ) );
$this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) );
$this->click( BUTTON_INSERTLINK );
@ -91,8 +101,10 @@ class WikiDialogs_Links_Setup extends SeleniumTestCase {
$this->getText( LINK_START . WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT ) );
$this->click( LINK_START . WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT );
$this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
$this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText( TEXT_PAGE_HEADING ) );
$this->assertTrue(
$this->isTextPresent( WIKI_INTERNAL_LINK ),
$this->getText( TEXT_PAGE_HEADING )
);
}
// Add a internal link with blank display text and verify
@ -124,8 +136,10 @@ class WikiDialogs_Links_Setup extends SeleniumTestCase {
$this->click( BUTTON_INSERTLINK );
$this->click( LINK_PREVIEW );
$this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
$this->assertEquals( WIKI_EXTERNAL_LINK, $this->getText( LINK_START . WIKI_EXTERNAL_LINK ) );
$this->assertEquals(
WIKI_EXTERNAL_LINK,
$this->getText( LINK_START . WIKI_EXTERNAL_LINK )
);
$this->click( LINK_START . WIKI_EXTERNAL_LINK );
$this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
$this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getTitle() );
@ -142,7 +156,10 @@ class WikiDialogs_Links_Setup extends SeleniumTestCase {
$this->click( BUTTON_INSERTLINK );
$this->click( LINK_PREVIEW );
$this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
$this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getText( LINK_START . WIKI_EXTERNAL_LINK_TITLE ) );
$this->assertEquals(
WIKI_EXTERNAL_LINK_TITLE,
$this->getText( LINK_START . WIKI_EXTERNAL_LINK_TITLE )
);
$this->click( LINK_START . ( WIKI_EXTERNAL_LINK_TITLE ) );
$this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
$this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getTitle() );

View file

@ -1,67 +0,0 @@
<?php
require_once 'WikiDialogs_Links_Setup.php';
/**
* Description of WikiNewPageDialogs
*
* @author bhagyag, pdhanda
*
* This test case is part of the WikiEditorTestSuite.
* Configuration for these tests are dosumented as part of extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php
*
*/
class WikiDialogs_Links extends WikiDialogs_Links_Setup {
// Set up the testing environment
function setup() {
parent::setUp();
parent::doCreateInternalTestPageIfMissing();
}
function tearDown() {
parent::doLogout();
parent::tearDown();
}
// Create a new page temporary
function createNewPage() {
parent::doOpenLink();
parent::login();
parent::doCreateNewPageTemporary();
}
// Add a internal link and verify
function testInternalLink() {
$this->createNewPage();
parent::verifyInternalLink();
}
// Add a internal link with different display text and verify
function testInternalLinkWithDisplayText() {
$this->createNewPage();
parent::verifyInternalLinkWithDisplayText();
}
// Add a internal link with blank display text and verify
function testInternalLinkWithBlankDisplayText() {
$this->createNewPage();
parent::verifyInternalLinkWithBlankDisplayText();
}
// Add external link and verify
function testExternalLink() {
$this->createNewPage();
parent::verifyExternalLink();
}
// Add external link with different display text and verify
function testExternalLinkWithDisplayText( ) {
$this->createNewPage();
parent::verifyExternalLinkWithDisplayText();
}
// Add external link with Blank display text and verify
function testExternalLinkWithBlankDisplayText() {
$this->createNewPage();
parent::verifyExternalLinkWithBlankDisplayText();
}
}

View file

@ -13,11 +13,13 @@ define ( 'LINK_PREVIEW', "wpPreview" );
define ( 'WIKI_SEARCH_PAGE', "Hair (musical)" ); // Page name to search
define ( 'WIKI_TEXT_SEARCH', "TV" ); // Text to search
define ( 'WIKI_INTERNAL_LINK', "Wikieditor-Fixture-Page" ); // Exisiting page name to add as an internal tag
// Existing page name to add as an internal tag
define ( 'WIKI_INTERNAL_LINK', "Wikieditor-Fixture-Page" );
define ( 'WIKI_EXTERNAL_LINK', "www.google.com" ); // External web site name
define ( 'WIKI_EXTERNAL_LINK_TITLE', "Google" ); // Page title of the external web site name
define ( 'WIKI_CODE_PATH', getcwd() ); // get the current path of the program
define ( 'WIKI_SCREENSHOTS_PATH', "screenshots" ); // the folder the error screen shots will be saved
// the folder the error screen shots will be saved
define ( 'WIKI_SCREENSHOTS_PATH', "screenshots" );
define ( 'WIKI_SCREENSHOTS_TYPE', "png" ); // screen print type
define ( 'WIKI_TEMP_NEWPAGE', "TestWikiPage" ); // temporary creating new page name
// for WikiCommonFunction_TC
@ -80,5 +82,3 @@ define ( 'BUTTON_CANCEL', "//button[4]" );
define ( 'TEXT_PREVIEW_TEXT1', "//div[@id='wikiPreview']/p[1]" );
define ( 'TEXT_PREVIEW_TEXT2', "//div[@id='wikiPreview']/p[2]" );
define ( 'TEXT_PREVIEW_TEXT3', "//div[@id='wikiPreview']/p[3]" );

View file

@ -23,7 +23,7 @@ class WikiEditorTestSuite extends SeleniumTestSuite
}
public function addTests() {
$testFiles = array(
'extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php'
'extensions/WikiEditor/tests/selenium/WikiDialogsLinks.php'
);
parent::addTestFiles( $testFiles );
}