11 of n.
Change-Id: Ifdaf198b16bf72e1e0a3d3802c041d239096ae28
$this->upload = new UploadTestHandler;
$this->hooks = $wgHooks;
- $wgHooks['InterwikiLoadPrefix'][] = function( $prefix, &$data ) {
+ $wgHooks['InterwikiLoadPrefix'][] = function ( $prefix, &$data ) {
return false;
};
}
/**
* First checks the return code
* of UploadBase::getTitle() and then the actual returned title
- *
+ *
* @dataProvider provideTestTitleValidation
*/
public function testTitleValidation( $srcFilename, $dstFilename, $code, $msg ) {
"$msg text" );
}
}
-
+
/**
* Test various forms of valid and invalid titles that can be supplied.
*/
public static function provideTestTitleValidation() {
return array(
/* Test a valid title */
- array( 'ValidTitle.jpg', 'ValidTitle.jpg', UploadBase::OK,
+ array( 'ValidTitle.jpg', 'ValidTitle.jpg', UploadBase::OK,
'upload valid title' ),
/* A title with a slash */
- array( 'A/B.jpg', 'B.jpg', UploadBase::OK,
+ array( 'A/B.jpg', 'B.jpg', UploadBase::OK,
'upload title with slash' ),
/* A title with illegal char */
- array( 'A:B.jpg', 'A-B.jpg', UploadBase::OK,
+ array( 'A:B.jpg', 'A-B.jpg', UploadBase::OK,
'upload title with colon' ),
/* Stripping leading File: prefix */
- array( 'File:C.jpg', 'C.jpg', UploadBase::OK,
+ array( 'File:C.jpg', 'C.jpg', UploadBase::OK,
'upload title with File prefix' ),
/* Test illegal suggested title (r94601) */
- array( '%281%29.JPG', null, UploadBase::ILLEGAL_FILENAME,
+ array( '%281%29.JPG', null, UploadBase::ILLEGAL_FILENAME,
'illegal title for upload' ),
/* A title without extension */
- array( 'A', null, UploadBase::FILETYPE_MISSING,
+ array( 'A', null, UploadBase::FILETYPE_MISSING,
'upload title without extension' ),
/* A title with no basename */
- array( '.jpg', null, UploadBase::MIN_LENGTH_PARTNAME,
+ array( '.jpg', null, UploadBase::MIN_LENGTH_PARTNAME,
'upload title without basename' ),
/* A title that is longer than 255 bytes */
- array( str_repeat( 'a', 255 ) . '.jpg', null, UploadBase::FILENAME_TOO_LONG,
+ array( str_repeat( 'a', 255 ) . '.jpg', null, UploadBase::FILENAME_TOO_LONG,
'upload title longer than 255 bytes' ),
/* A title that is longer than 240 bytes */
- array( str_repeat( 'a', 240 ) . '.jpg', null, UploadBase::FILENAME_TOO_LONG,
+ array( str_repeat( 'a', 240 ) . '.jpg', null, UploadBase::FILENAME_TOO_LONG,
'upload title longer than 240 bytes' ),
);
}
$wgMaxUploadSize = 100;
$filename = $this->createFileOfSize( $wgMaxUploadSize );
- $this->upload->initializePathInfo( basename($filename) . '.txt', $filename, 100 );
+ $this->upload->initializePathInfo( basename( $filename ) . '.txt', $filename, 100 );
$result = $this->upload->verifyUpload();
unlink( $filename );
$this->assertEquals(
array( 'status' => UploadBase::OK ), $result );
- $wgMaxUploadSize = $savedGlobal; // restore global
+ $wgMaxUploadSize = $savedGlobal; // restore global
}
}
class UploadTestHandler extends UploadBase {
- public function initializeFromRequest( &$request ) { }
- public function testTitleValidation( $name ) {
- $this->mTitle = false;
- $this->mDesiredDestName = $name;
- $this->mTitleError = UploadBase::OK;
- $this->getTitle();
- return $this->mTitleError;
- }
+ public function initializeFromRequest( &$request ) {}
+
+ public function testTitleValidation( $name ) {
+ $this->mTitle = false;
+ $this->mDesiredDestName = $name;
+ $this->mTitleError = UploadBase::OK;
+ $this->getTitle();
+ return $this->mTitleError;
+ }
}
return;
}
- return call_user_func_array ( array( "parent", __FUNCTION__ ), func_get_args() );
+ return call_user_func_array( array( "parent", __FUNCTION__ ), func_get_args() );
}
/**
* Safety net around register_shutdown_function of Maintenance.php
*/
public function __destruct() {
- if ( ! $this->shutdownSimulated ) {
+ if ( !$this->shutdownSimulated ) {
// Someone generated a MaintenanceFixup instance without calling
// simulateShutdown. We'd have to raise a PHPUnit exception to correctly
// flag this illegal usage. However, we are already in a destruktor, which
}
-
// --- Making protected functions visible for test
public function output( $out, $channel = null ) {
// Maintenance::output signature. However, we do not use (or rely on)
// those variables. Instead we pass to Maintenance::output whatever we
// receive at runtime.
- return call_user_func_array ( array( "parent", __FUNCTION__ ), func_get_args() );
+ return call_user_func_array( array( "parent", __FUNCTION__ ), func_get_args() );
}
-
// --- Requirements for getting instance of abstract class
public function execute() {
private function assertOutputPrePostShutdown( $preShutdownOutput, $expectNLAppending ) {
$this->assertEquals( $preShutdownOutput, $this->getActualOutput(),
- "Output before shutdown simulation" );
+ "Output before shutdown simulation" );
$this->m->simulateShutdown();
$this->m = null;
$m2->output( "bar" );
$this->assertEquals( "foobar", $this->getActualOutput(),
- "Output before shutdown simulation (m2)" );
+ "Output before shutdown simulation (m2)" );
$m2->simulateShutdown();
$this->assertOutputPrePostShutdown( "foobar", false );
}
$m2->output( "bar", null );
$this->assertEquals( "foobar", $this->getActualOutput(),
- "Output before shutdown simulation (m2)" );
+ "Output before shutdown simulation (m2)" );
$m2->simulateShutdown();
$this->assertOutputPrePostShutdown( "foobar", false );
}
$m2->output( "bar", "bazChannel" );
$this->assertEquals( "foobar", $this->getActualOutput(),
- "Output before shutdown simulation (m2)" );
+ "Output before shutdown simulation (m2)" );
$m2->simulateShutdown();
$this->assertOutputPrePostShutdown( "foobar\n", true );
}
$m2->output( "bar\n", null );
$this->assertEquals( "foo\nbar\n", $this->getActualOutput(),
- "Output before shutdown simulation (m2)" );
+ "Output before shutdown simulation (m2)" );
$m2->simulateShutdown();
$this->assertOutputPrePostShutdown( "foo\nbar\n", false );
}
$m2->output( "bar\n", "bazChannel" );
$this->assertEquals( "foobar", $this->getActualOutput(),
- "Output before shutdown simulation (m2)" );
+ "Output before shutdown simulation (m2)" );
$m2->simulateShutdown();
$this->assertOutputPrePostShutdown( "foobar\n", true );
}
$m2->outputChanneled( "bar" );
$this->assertEquals( "foo\nbar\n", $this->getActualOutput(),
- "Output before shutdown simulation (m2)" );
+ "Output before shutdown simulation (m2)" );
$m2->simulateShutdown();
$this->assertOutputPrePostShutdown( "foo\nbar\n", false );
}
$m2->outputChanneled( "bar", null );
$this->assertEquals( "foo\nbar\n", $this->getActualOutput(),
- "Output before shutdown simulation (m2)" );
+ "Output before shutdown simulation (m2)" );
$m2->simulateShutdown();
$this->assertOutputPrePostShutdown( "foo\nbar\n", false );
}
$m2->outputChanneled( "bar", "bazChannel" );
$this->assertEquals( "foobar", $this->getActualOutput(),
- "Output before shutdown simulation (m2)" );
+ "Output before shutdown simulation (m2)" );
$m2->simulateShutdown();
$this->assertOutputPrePostShutdown( "foobar\n", true );
}
$m2->outputChanneled( "bar", "bazChannel" );
$this->assertEquals( "foobar", $this->getActualOutput(),
- "Output before first cleanup" );
+ "Output before first cleanup" );
$this->m->cleanupChanneled();
$this->assertEquals( "foobar\n", $this->getActualOutput(),
- "Output after first cleanup" );
+ "Output after first cleanup" );
$m2->cleanupChanneled();
$this->assertEquals( "foobar\n\n", $this->getActualOutput(),
- "Output after second cleanup" );
+ "Output after second cleanup" );
$m2->simulateShutdown();
$this->assertOutputPrePostShutdown( "foobar\n\n", false );
$this->setMwGlobals( array(
'wgLanguageCode' => 'en',
'wgContLang' => Language::factory( 'en' ),
- ));
+ ) );
$this->tablesUsed[] = 'page';
$this->tablesUsed[] = 'revision';
if ( $this->namespace === $this->talk_namespace ) {
//@todo: work around this.
throw new MWException( "The default wikitext namespace is the talk namespace. "
- . " We can't currently deal with that.");
+ . " We can't currently deal with that." );
}
$this->pageTitle1 = Title::newFromText( 'BackupDumperTestP1', $this->namespace );
}
- function testFullTextPlain () {
+ function testFullTextPlain() {
// Preparing the dump
$fname = $this->getNewTempFile();
- $dumper = new BackupDumper( array ( "--output=file:" . $fname ) );
+ $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
$dumper->startId = $this->pageId1;
$dumper->endId = $this->pageId4 + 1;
$dumper->reporting = false;
$this->assertDumpEnd();
}
- function testFullStubPlain () {
+ function testFullStubPlain() {
// Preparing the dump
$fname = $this->getNewTempFile();
- $dumper = new BackupDumper( array ( "--output=file:" . $fname ) );
+ $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
$dumper->startId = $this->pageId1;
$dumper->endId = $this->pageId4 + 1;
$dumper->reporting = false;
$this->assertDumpEnd();
}
- function testCurrentStubPlain () {
+ function testCurrentStubPlain() {
// Preparing the dump
$fname = $this->getNewTempFile();
- $dumper = new BackupDumper( array ( "--output=file:" . $fname ) );
+ $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
$dumper->startId = $this->pageId1;
$dumper->endId = $this->pageId4 + 1;
$dumper->reporting = false;
$this->assertDumpEnd();
}
- function testCurrentStubGzip () {
+ function testCurrentStubGzip() {
$this->checkHasGzip();
// Preparing the dump
$fname = $this->getNewTempFile();
- $dumper = new BackupDumper( array ( "--output=gzip:" . $fname ) );
+ $dumper = new BackupDumper( array( "--output=gzip:" . $fname ) );
$dumper->startId = $this->pageId1;
$dumper->endId = $this->pageId4 + 1;
$dumper->reporting = false;
}
-
- function testXmlDumpsBackupUseCase () {
+ function testXmlDumpsBackupUseCase() {
// xmldumps-backup typically performs a single dump that that writes
// out three files
// * gzipped stubs of everything (meta-history)
$fnameMetaCurrent = $this->getNewTempFile();
$fnameArticles = $this->getNewTempFile();
- $dumper = new BackupDumper( array ( "--output=gzip:" . $fnameMetaHistory,
- "--output=gzip:" . $fnameMetaCurrent, "--filter=latest",
- "--output=gzip:" . $fnameArticles, "--filter=latest",
- "--filter=notalk", "--filter=namespace:!NS_USER",
- "--reporting=1000" ) );
+ $dumper = new BackupDumper( array( "--output=gzip:" . $fnameMetaHistory,
+ "--output=gzip:" . $fnameMetaCurrent, "--filter=latest",
+ "--output=gzip:" . $fnameArticles, "--filter=latest",
+ "--filter=notalk", "--filter=namespace:!NS_USER",
+ "--reporting=1000" ) );
$dumper->startId = $this->pageId1;
$dumper->endId = $this->pageId4 + 1;
$dumper->setDb( $this->db );
}
-
}
private $mockInvocations = array( 'getStdin' => 0 );
-
/**
* Data for the fake stdin
*
"Tried to get stdin with non null parameter" );
}
- if ( ! $this->mockSetUp ) {
+ if ( !$this->mockSetUp ) {
throw new PHPUnit_Framework_ExpectationFailedException(
"Tried to get stdin before setting up rerouting" );
}
}
-
// Instead of the following functions, a data provider would be great.
// However, as data providers are evaluated /before/ addDBData, a data
// provider would not know the required ids.
function testExistingSeveral() {
$this->assertFilter( "$this->textId1\n$this->textId5\n"
- . "$this->textId3\n$this->textId3",
+ . "$this->textId3\n$this->textId3",
implode( "", array(
- $this->textId1 . "\n23\nFetchTextTestPage1Text1",
- $this->textId5 . "\n44\nFetchTextTestPage2Text4 "
+ $this->textId1 . "\n23\nFetchTextTestPage1Text1",
+ $this->textId5 . "\n44\nFetchTextTestPage2Text4 "
. "some additional Text",
- $this->textId3 . "\n23\nFetchTextTestPage2Text2",
- $this->textId3 . "\n23\nFetchTextTestPage2Text2"
- ) ) );
+ $this->textId3 . "\n23\nFetchTextTestPage2Text2",
+ $this->textId3 . "\n23\nFetchTextTestPage2Text2"
+ ) ) );
}
function testEmpty() {
function testMix() {
$this->assertFilter( "ab\n" . $this->textId4 . ".5cd\n\nefg\n" . $this->textId2
- . "\n" . $this->textId3,
+ . "\n" . $this->textId3,
implode( "", array(
- "0\n-1\n",
- $this->textId4 . "\n23\nFetchTextTestPage2Text3",
- "0\n-1\n",
- "0\n-1\n",
- $this->textId2 . "\n23\nFetchTextTestPage2Text1",
- $this->textId3 . "\n23\nFetchTextTestPage2Text2"
- ) ) );
+ "0\n-1\n",
+ $this->textId4 . "\n23\nFetchTextTestPage2Text3",
+ "0\n-1\n",
+ "0\n-1\n",
+ $this->textId2 . "\n23\nFetchTextTestPage2Text1",
+ $this->textId3 . "\n23\nFetchTextTestPage2Text2"
+ ) ) );
}
}
'helppage',
);
- foreach( $URL_messages as $m ) {
- $titleName = MessageCache::singleton()->get($m);
+ foreach ( $URL_messages as $m ) {
+ $titleName = MessageCache::singleton()->get( $m );
$title = Title::newFromText( $titleName );
$this->messages[$m]['href'] = $title->getLocalURL();
}
$this->skin = new SkinTemplate();
$this->skin->getContext()->setLanguage( Language::factory( 'en' ) );
}
+
protected function tearDown() {
parent::tearDown();
$this->skin = null;
function testSidebarWithOnlyTwoTitles() {
$this->assertSideBar(
- array(
- 'Title1' => array(),
- 'Title2' => array(),
- ),
-'* Title1
+ array(
+ 'Title1' => array(),
+ 'Title2' => array(),
+ ),
+ '* Title1
* Title2
'
);
function testExpandMessages() {
$this->assertSidebar(
- array( 'Title' => array(
- array(
- 'text' => 'Help',
- 'href' => $this->messages['helppage']['href'],
- 'id' => 'n-help',
- 'active' => null
- )
- )),
-'* Title
+ array( 'Title' => array(
+ array(
+ 'text' => 'Help',
+ 'href' => $this->messages['helppage']['href'],
+ 'id' => 'n-help',
+ 'active' => null
+ )
+ ) ),
+ '* Title
** helppage|help
'
);
function testExternalUrlsRequireADescription() {
$this->assertSidebar(
- array( 'Title' => array(
- # ** http://www.mediawiki.org/| Home
- array(
- 'text' => 'Home',
- 'href' => 'http://www.mediawiki.org/',
- 'id' => 'n-Home',
- 'active' => null,
- 'rel' => 'nofollow',
- ),
- # ** http://valid.no.desc.org/
- # ... skipped since it is missing a pipe with a description
- )),
-'* Title
+ array( 'Title' => array(
+ # ** http://www.mediawiki.org/| Home
+ array(
+ 'text' => 'Home',
+ 'href' => 'http://www.mediawiki.org/',
+ 'id' => 'n-Home',
+ 'active' => null,
+ 'rel' => 'nofollow',
+ ),
+ # ** http://valid.no.desc.org/
+ # ... skipped since it is missing a pipe with a description
+ ) ),
+ '* Title
** http://www.mediawiki.org/| Home
** http://valid.no.desc.org/
'
-
);
}
+
/**
* bug 33321 - Make sure there's a | after transforming.
* @group Database
*/
function testTrickyPipe() {
$this->assertSidebar(
- array( 'Title' => array(
- # The first 2 are skipped
- # Doesn't really test the url properly
- # because it will vary with $wgArticlePath et al.
- # ** Baz|Fred
- array(
- 'text' => 'Fred',
- 'href' => Title::newFromText( 'Baz' )->getLocalUrl(),
- 'id' => 'n-Fred',
- 'active' => null,
- ),
- array(
- 'text' => 'title-to-display',
- 'href' => Title::newFromText( 'page-to-go-to' )->getLocalUrl(),
- 'id' => 'n-title-to-display',
- 'active' => null,
- ),
- )),
-'* Title
+ array( 'Title' => array(
+ # The first 2 are skipped
+ # Doesn't really test the url properly
+ # because it will vary with $wgArticlePath et al.
+ # ** Baz|Fred
+ array(
+ 'text' => 'Fred',
+ 'href' => Title::newFromText( 'Baz' )->getLocalUrl(),
+ 'id' => 'n-Fred',
+ 'active' => null,
+ ),
+ array(
+ 'text' => 'title-to-display',
+ 'href' => Title::newFromText( 'page-to-go-to' )->getLocalUrl(),
+ 'id' => 'n-title-to-display',
+ 'active' => null,
+ ),
+ ) ),
+ '* Title
** {{PAGENAME|Foo}}
** Bar
** Baz|Fred
** {{PLURAL:1|page-to-go-to{{int:pipe-separator/en}}title-to-display|branch not taken}}
'
);
-
}
#### Attributes for external links ##########################
- private function getAttribs( ) {
+ private function getAttribs() {
# Sidebar text we will use everytime
$text = '* Title
** http://www.mediawiki.org/| Home';
protected function setUp() {
global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc,
- $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache,
- $wgNamespaceAliases, $wgNamespaceProtection, $parserMemc;
+ $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache,
+ $wgNamespaceAliases, $wgNamespaceProtection, $parserMemc;
$tmpGlobals = array();
$tmpGlobals['wgStylePath'] = '/skins';
$tmpGlobals['wgThumbnailScriptPath'] = false;
$tmpGlobals['wgLocalFileRepo'] = array(
- 'class' => 'LocalRepo',
- 'name' => 'local',
- 'url' => 'http://example.com/images',
- 'hashLevels' => 2,
+ 'class' => 'LocalRepo',
+ 'name' => 'local',
+ 'url' => 'http://example.com/images',
+ 'hashLevels' => 2,
'transformVia404' => false,
- 'backend' => new FSFileBackend( array(
- 'name' => 'local-backend',
+ 'backend' => new FSFileBackend( array(
+ 'name' => 'local-backend',
'lockManager' => 'fsLockManager',
'containerPaths' => array(
- 'local-public' => wfTempDir() . '/test-repo/public',
- 'local-thumb' => wfTempDir() . '/test-repo/thumb',
- 'local-temp' => wfTempDir() . '/test-repo/temp',
+ 'local-public' => wfTempDir() . '/test-repo/public',
+ 'local-thumb' => wfTempDir() . '/test-repo/thumb',
+ 'local-temp' => wfTempDir() . '/test-repo/temp',
'local-deleted' => wfTempDir() . '/test-repo/delete',
)
) ),
$wgRequest = $context->getRequest();
if ( $wgStyleDirectory === false ) {
- $wgStyleDirectory = "$IP/skins";
+ $wgStyleDirectory = "$IP/skins";
}
RepoGroup::destroySingleton();
// delete the files first, then the dirs.
self::deleteFiles(
- array (
+ array(
"$dir/3/3a/Foobar.jpg",
"$dir/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg",
"$dir/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg",
);
self::deleteDirs(
- array (
+ array(
"$dir/3/3a",
"$dir/3",
"$dir/thumb/6/65",
public function start() {
$this->tester = new Testing_Selenium( $this->browser, self::$url, $this->host,
$this->port, $this->timeout );
- if ( method_exists( $this->tester, "setVerbose" ) ) $this->tester->setVerbose( $this->verbose );
+ if ( method_exists( $this->tester, "setVerbose" ) ) {
+ $this->tester->setVerbose( $this->verbose );
+ }
$this->tester->start();
$this->isStarted = true;
$this->logger = $logger;
}
- public function getLogger( ) {
+ public function getLogger() {
return $this->logger;
}
$this->user = $user;
}
- // Function to get username
- public function getUser() {
+ // Function to get username
+ public function getUser() {
return $this->user;
}
-
+
public function setPass( $pass ) {
$this->pass = $pass;
}
- //add function to get password
- public function getPass( ) {
+ //add function to get password
+ public function getPass() {
return $this->pass;
}
-
-
+
public function setHost( $host ) {
$this->host = $host;
}
$this->junitlogfile = $junitlogfile;
}
- public function getJUnitLogfile( ) {
+ public function getJUnitLogfile() {
return $this->junitlogfile;
}
}
public function setBrowser( $b ) {
- if ($this->runagainstgrid) {
+ if ( $this->runagainstgrid ) {
$this->browser = $b;
return true;
}
}
// Prevent external cloning
- protected function __clone() { }
+ protected function __clone() {}
// Prevent external construction
// protected function __construct() {}
}
private $SeleniumServerExecPath;
public function __construct( $startServer,
- $serverPort,
- $serverExecPath ) {
- $this->OS = (string) PHP_OS;
- if ( isset( $startServer ) )
+ $serverPort,
+ $serverExecPath ) {
+ $this->OS = (string)PHP_OS;
+
+ if ( isset( $startServer ) ) {
$this->SeleniumStartServer = $startServer;
- if ( isset( $serverPort ) )
+ }
+
+ if ( isset( $serverPort ) ) {
$this->SeleniumServerPort = $serverPort;
- if ( isset( $serverExecPath ) )
+ }
+
+ if ( isset( $serverExecPath ) ) {
$this->SeleniumServerExecPath = $serverExecPath;
+ }
+
return;
}
// to true, since after server is started, it is shut down by stop().
public function setSeleniumStartServer( $startServer ) {
- if ( $startServer == true ) $this->SeleniumStartServer = true;
+ if ( $startServer == true ) {
+ $this->SeleniumStartServer = true;
+ }
}
// return values are: 1) started - server started, 2) failed -
public function start() {
- if ( !$this->SeleniumStartServer ) return 'failed';
+ if ( !$this->SeleniumStartServer ) {
+ return 'failed';
+ }
// commented out cases are untested
$output = array();
$user = $_ENV['USER'];
// @todo FIXME: This should be a little more generalized :)
- if (PHP_OS == 'Darwin') {
+ if ( PHP_OS == 'Darwin' ) {
// Mac OS X's ps barfs on the 'w' param, but doesn't need it.
$ps = "ps -U %s";
} else {
// Good on Linux
$ps = "ps -U %s w";
}
- $psCommand = sprintf($ps, escapeshellarg($user));
- exec($psCommand . " | grep -i selenium-server", $output);
+ $psCommand = sprintf( $ps, escapeshellarg( $user ) );
+ exec( $psCommand . " | grep -i selenium-server", $output );
// Start server. If there is already a server running,
// return running.
// The echo guarentees it is put into $op when
// the exec command is run.
- $commandSuffix = ' > /dev/null 2>&1'. ' & echo $!';
+ $commandSuffix = ' > /dev/null 2>&1' . ' & echo $!';
$portText = ' -port ' . $this->SeleniumServerPort;
$command = "java -jar " .
- escapeshellarg($this->SeleniumServerExecPath) .
+ escapeshellarg( $this->SeleniumServerExecPath ) .
$portText . $commandSuffix;
- exec($command ,$op);
+ exec( $command, $op );
$pid = (int)$op[0];
- if ( $pid != "" )
+ if ( $pid != "" ) {
$this->SeleniumServerPid = $pid;
- else {
+ } else {
$this->SeleniumServerPid = 'NaN';
// Server start failed.
return 'failed';
for ( $cnt = 1;
$cnt <= $this->SeleniumServerStartTimeout;
$cnt++ ) {
- $fp = fsockopen ( 'localhost',
+ $fp = fsockopen( 'localhost',
$this->SeleniumServerPort,
$errno, $errstr, 0 );
if ( !$fp ) {
sleep( 1 );
continue;
- // Server start succeeded.
+ // Server start succeeded.
} else {
- fclose ( $fp );
+ fclose( $fp );
return 'started';
}
}
wfRestoreWarnings();
echo ( "Starting Selenium server timed out.\n" );
return 'failed';
+ } else {
+ // server already running.
+ return 'running';
}
- // server already running.
- else return 'running';
}
- // No Server execution path defined.
+
+ // No Server execution path defined.
return 'failed';
}
private function stopServerOnUnix() {
if ( !empty( $this->SeleniumServerPid ) &&
- $this->SeleniumServerPid != 'NaN' ) {
+ $this->SeleniumServerPid != 'NaN'
+ ) {
exec( "kill -9 " . $this->SeleniumServerPid );
return 'stopped';
+ } else {
+ return 'failed';
}
- else return 'failed';
}
private function stopServerOnWindows() {
<?php
-include("SeleniumTestConstants.php");
+include( "SeleniumTestConstants.php" );
class SeleniumTestCase extends PHPUnit_Framework_TestCase { // PHPUnit_Extensions_SeleniumTestCase
protected $selenium;
*/
function createTestPageIfMissing( $pageName = null ) {
if ( $pageName == null ) {
- $pageName = SeleniumTestConstants::WIKI_INTERNAL_LINK;
+ $pageName = SeleniumTestConstants::WIKI_INTERNAL_LINK;
}
- $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, $pageName );
+ $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, $pageName );
$this->click( SeleniumTestConstants::BUTTON_SEARCH );
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
$this->click( SeleniumTestConstants::LINK_START . $pageName );
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $location = $this->getLocation() . "\n";
- if ( strpos( $location, '&redlink=1') !== false ) {
- $this->type( SeleniumTestConstants::TEXT_EDITOR, "Test fixture page. No real content here" );
+ $location = $this->getLocation() . "\n";
+ if ( strpos( $location, '&redlink=1' ) !== false ) {
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, "Test fixture page. No real content here" );
$this->click( SeleniumTestConstants::BUTTON_SAVE );
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
$this->assertTrue( $this->isTextPresent( $pageName ),
- $this->getText( SeleniumTestConstants::TEXT_PAGE_HEADING ) );
+ $this->getText( SeleniumTestConstants::TEXT_PAGE_HEADING ) );
}
}
-
+
/**
* Create a test page using date as part of the name so that it is unique
* @param $pagePrefix The prefix to use for the page name. The current date will be appended to this to make it unique
* @param $watchThis Whether to add the page to my watchlist. Defaults to false.
*/
function createNewTestPage( $pagePrefix, $watchThis = false ) {
- $pageName = $pagePrefix . date("Ymd-His");
- $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, $pageName );
+ $pageName = $pagePrefix . date( "Ymd-His" );
+ $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, $pageName );
$this->click( SeleniumTestConstants::BUTTON_SEARCH );
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
$this->click( SeleniumTestConstants::LINK_START . $pageName );
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $location = $this->getLocation() . "\n";
- $this->assertContains( '&redlink=1', $location ).
- $this->type( SeleniumTestConstants::TEXT_EDITOR, "Test fixture page. No real content here" );
+ $location = $this->getLocation() . "\n";
+ $this->assertContains( '&redlink=1', $location ) .
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, "Test fixture page. No real content here" );
if ( $watchThis ) {
$this->click( "wpWatchthis" );
}
$this->click( SeleniumTestConstants::BUTTON_SAVE );
$this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
$this->assertTrue( $this->isTextPresent( $pageName ),
- $this->getText( SeleniumTestConstants::TEXT_PAGE_HEADING ) );
+ $this->getText( SeleniumTestConstants::TEXT_PAGE_HEADING ) );
return $pageName;
}
- public function getExistingPage(){
+ public function getExistingPage() {
$this->open( $this->getUrl() .
'/index.php?title=Main_Page&action=edit' );
- $this->type("searchInput", "new" );
- $this->click("searchGoButton");
- $this->waitForPageToLoad("30000");
+ $this->type( "searchInput", "new" );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "30000" );
}
- public function getNewPage($pageName){
+ public function getNewPage( $pageName ) {
$this->open( $this->getUrl() .
'/index.php?title=Main_Page&action=edit' );
- $this->type("searchInput", $pageName );
- $this->click("searchGoButton");
- $this->waitForPageToLoad("30000");
- $this->click("link=".$pageName);
- $this->waitForPageToLoad("600000");
+ $this->type( "searchInput", $pageName );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( "30000" );
+ $this->click( "link=" . $pageName );
+ $this->waitForPageToLoad( "600000" );
}
+
// Loading the mediawiki editor
- public function loadWikiEditor(){
+ public function loadWikiEditor() {
$this->open( $this->getUrl() .
'/index.php?title=Main_Page&action=edit' );
}
// Clear the content of the mediawiki editor
- public function clearWikiEditor(){
- $this->type("wpTextbox1", "");
+ public function clearWikiEditor() {
+ $this->type( "wpTextbox1", "" );
}
// Click on the 'Show preview' button of the mediawiki editor
- public function clickShowPreviewBtn(){
- $this->click("wpPreview");
+ public function clickShowPreviewBtn() {
+ $this->click( "wpPreview" );
}
// Click on the 'Save Page' button of the mediawiki editor
- public function clickSavePageBtn(){
- $this->click("wpSave");
+ public function clickSavePageBtn() {
+ $this->click( "wpSave" );
}
// Click on the 'Edit' link
- public function clickEditLink(){
- $this->click("link=Edit");
- $this->waitForPageToLoad("30000");
+ public function clickEditLink() {
+ $this->click( "link=Edit" );
+ $this->waitForPageToLoad( "30000" );
}
-
}
*/
-require_once (__DIR__.'/'.'MediaWikiInstallationCommonFunction.php');
+require_once ( __DIR__ . '/' . 'MediaWikiInstallationCommonFunction.php' );
/**
* Test Case ID : 30 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
* Test Case Name :'Back' and 'Continue' button availability
* Version : MediaWiki 1.18alpha
-*/
-
+ */
class MediaWikiButtonsAvailabilityTestCase extends MediaWikiInstallationCommonFunction {
-
- function setUp() {
- parent::setUp();
- }
-
-
- // Verify only 'Continue' button available on 'Language' page
- public function testOnlyContinueButtonAvailability() {
-
- parent::navigateLanguagePage();
-
- // Verify only 'Continue' button avaialble
- $this->assertTrue( $this->isElementPresent( "submit-continue" ));
-
- // 'Back' button is not avaialble
- $this->assertElementNotPresent( "submit-back" );
- }
-
-
- // Verify 'Continue' and 'Back' buttons availability
- public function testBothButtonsAvailability() {
-
- // Verify buttons availability on 'Welcome to MediaWiki' page
- parent::navigateWelcometoMediaWikiPage();
- $this->assertTrue( $this->isElementPresent( "submit-back" ));
- $this->assertTrue( $this->isElementPresent( "submit-continue" ));
- parent::restartInstallation();
-
- // Verify buttons availability on 'Connect to Database' page
- parent::navigateConnetToDatabasePage();
- $this->assertTrue( $this->isElementPresent( "submit-back" ));
- $this->assertTrue( $this->isElementPresent( "submit-continue" ));
- parent::restartInstallation();
-
- // Verify buttons availability on 'Database settings' page
- $databaseName = DB_NAME_PREFIX."_db_settings";
- parent::navigateDatabaseSettingsPage( $databaseName );
- $this->assertTrue( $this->isElementPresent( "submit-back" ));
- $this->assertTrue( $this->isElementPresent( "submit-continue" ));
- parent::restartInstallation();
-
- // Verify buttons availability on 'Name' page
- $databaseName = DB_NAME_PREFIX."_name";
- parent::navigateNamePage( $databaseName );
- $this->assertTrue( $this->isElementPresent( "submit-back" ));
- $this->assertTrue( $this->isElementPresent( "submit-continue" ));
- parent::restartInstallation();
-
- // Verify buttons availability on 'Options' page
- $databaseName = DB_NAME_PREFIX."_options";
- parent::navigateOptionsPage( $databaseName );
- $this->assertTrue( $this->isElementPresent( "submit-back" ));
- $this->assertTrue( $this->isElementPresent( "submit-continue" ));
- parent::restartInstallation();
-
- // Verify buttons availability on 'Install' page
- $databaseName = DB_NAME_PREFIX."_install";
- parent::navigateInstallPage($databaseName);
- $this->assertTrue( $this->isElementPresent( "submit-back" ));
- $this->assertTrue( $this->isElementPresent( "submit-continue" ));
- }
+ function setUp() {
+ parent::setUp();
+ }
+
+ // Verify only 'Continue' button available on 'Language' page
+ public function testOnlyContinueButtonAvailability() {
+ parent::navigateLanguagePage();
+
+ // Verify only 'Continue' button avaialble
+ $this->assertTrue( $this->isElementPresent( "submit-continue" ) );
+
+ // 'Back' button is not avaialble
+ $this->assertElementNotPresent( "submit-back" );
+ }
+
+ // Verify 'Continue' and 'Back' buttons availability
+ public function testBothButtonsAvailability() {
+ // Verify buttons availability on 'Welcome to MediaWiki' page
+ parent::navigateWelcometoMediaWikiPage();
+ $this->assertTrue( $this->isElementPresent( "submit-back" ) );
+ $this->assertTrue( $this->isElementPresent( "submit-continue" ) );
+ parent::restartInstallation();
+
+ // Verify buttons availability on 'Connect to Database' page
+ parent::navigateConnetToDatabasePage();
+ $this->assertTrue( $this->isElementPresent( "submit-back" ) );
+ $this->assertTrue( $this->isElementPresent( "submit-continue" ) );
+ parent::restartInstallation();
+
+ // Verify buttons availability on 'Database settings' page
+ $databaseName = DB_NAME_PREFIX . "_db_settings";
+ parent::navigateDatabaseSettingsPage( $databaseName );
+ $this->assertTrue( $this->isElementPresent( "submit-back" ) );
+ $this->assertTrue( $this->isElementPresent( "submit-continue" ) );
+ parent::restartInstallation();
+
+ // Verify buttons availability on 'Name' page
+ $databaseName = DB_NAME_PREFIX . "_name";
+ parent::navigateNamePage( $databaseName );
+ $this->assertTrue( $this->isElementPresent( "submit-back" ) );
+ $this->assertTrue( $this->isElementPresent( "submit-continue" ) );
+ parent::restartInstallation();
+
+ // Verify buttons availability on 'Options' page
+ $databaseName = DB_NAME_PREFIX . "_options";
+ parent::navigateOptionsPage( $databaseName );
+ $this->assertTrue( $this->isElementPresent( "submit-back" ) );
+ $this->assertTrue( $this->isElementPresent( "submit-continue" ) );
+ parent::restartInstallation();
+
+ // Verify buttons availability on 'Install' page
+ $databaseName = DB_NAME_PREFIX . "_install";
+ parent::navigateInstallPage( $databaseName );
+ $this->assertTrue( $this->isElementPresent( "submit-back" ) );
+ $this->assertTrue( $this->isElementPresent( "submit-continue" ) );
+ }
}
* Test Case ID : 04 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
* Test Case Name : Install MediaWiki with different Database accounts for web access.
* Version : MediaWiki 1.18alpha
-*/
+ */
class MediaWikiDifferentDatabaseAccountTestCase extends MediaWikiInstallationCommonFunction {
+ function setUp() {
+ parent::setUp();
+ }
- function setUp() {
- parent::setUp();
- }
-
-
- // Install Mediawiki using 'MySQL' database type.
- public function testDifferentDatabaseAccount() {
-
- $databaseName = DB_NAME_PREFIX."_dif_accounts";
+ // Install Mediawiki using 'MySQL' database type.
+ public function testDifferentDatabaseAccount() {
+ $databaseName = DB_NAME_PREFIX . "_dif_accounts";
- // Navigate to the 'Database settings' page
- parent::navigateDatabaseSettingsPage( $databaseName );
+ // Navigate to the 'Database settings' page
+ parent::navigateDatabaseSettingsPage( $databaseName );
- // Click on the 'Use the same account as for installation' check box
- $this->click( "mysql__SameAccount" );
+ // Click on the 'Use the same account as for installation' check box
+ $this->click( "mysql__SameAccount" );
- // Change the 'Database username'
- $this->type( "mysql_wgDBuser", DB_WEB_USER );
+ // Change the 'Database username'
+ $this->type( "mysql_wgDBuser", DB_WEB_USER );
- // Enter 'Database password:'
- $this->type( "mysql_wgDBpassword", DB_WEB_USER_PASSWORD );
+ // Enter 'Database password:'
+ $this->type( "mysql_wgDBpassword", DB_WEB_USER_PASSWORD );
- // Select 'Create the account if it does not already exist' check box
- $this->click( "mysql__CreateDBAccount" );
- parent::clickContinueButton();
+ // Select 'Create the account if it does not already exist' check box
+ $this->click( "mysql__CreateDBAccount" );
+ parent::clickContinueButton();
- // 'Name' page
- parent::completeNamePage();
+ // 'Name' page
+ parent::completeNamePage();
- // 'Options' page
- parent::clickContinueButton();
+ // 'Options' page
+ parent::clickContinueButton();
- // 'Install' page
- $this->assertEquals("Creating database user... done",
- $this->getText( LINK_FORM."ul/li[3]"));
- parent::clickContinueButton();
+ // 'Install' page
+ $this->assertEquals( "Creating database user... done",
+ $this->getText( LINK_FORM . "ul/li[3]" ) );
+ parent::clickContinueButton();
- // 'Complete' page
- parent::completePageSuccessfull();
- $this->chooseCancelOnNextConfirmation();
- }
+ // 'Complete' page
+ parent::completePageSuccessfull();
+ $this->chooseCancelOnNextConfirmation();
+ }
}
* Test Case Name : Install MediaWiki with the same database and the different
* database prefixes(Share one database between multiple wikis).
* Version : MediaWiki 1.18alpha
-*/
+ */
class MediaWikiDifferntDatabasePrefixTestCase extends MediaWikiInstallationCommonFunction {
+ function setUp() {
+ parent::setUp();
+ }
- function setUp() {
- parent::setUp();
- }
-
- // Install Mediawiki using 'MySQL' database type.
- public function testDifferentDatabasePrefix() {
-
- $databaseName = DB_NAME_PREFIX."_db_prefix";
- parent::navigateInstallPage( $databaseName );
+ // Install Mediawiki using 'MySQL' database type.
+ public function testDifferentDatabasePrefix() {
+ $databaseName = DB_NAME_PREFIX . "_db_prefix";
+ parent::navigateInstallPage( $databaseName );
- // To 'Options' page
- parent::clickBackButton();
+ // To 'Options' page
+ parent::clickBackButton();
- // To 'Name' page
- parent::clickBackButton();
+ // To 'Name' page
+ parent::clickBackButton();
- // To 'Database settings' page
- parent::clickBackButton();
+ // To 'Database settings' page
+ parent::clickBackButton();
- // To 'Connect to database' page
- parent::clickBackButton();
+ // To 'Connect to database' page
+ parent::clickBackButton();
- // From 'Connect to database' page without database prefix
- parent::clickContinueButton();
+ // From 'Connect to database' page without database prefix
+ parent::clickContinueButton();
- // Verify upgrade existing message
- $this->assertEquals( "Upgrade existing installation",
- $this->getText( LINK_DIV."h2" ));
+ // Verify upgrade existing message
+ $this->assertEquals( "Upgrade existing installation",
+ $this->getText( LINK_DIV . "h2" ) );
- // To 'Connect to database' page
- parent::clickBackButton();
+ // To 'Connect to database' page
+ parent::clickBackButton();
- // Input the database prefix
- $this->type( "mysql_wgDBprefix", DATABASE_PREFIX );
+ // Input the database prefix
+ $this->type( "mysql_wgDBprefix", DATABASE_PREFIX );
- // From 'Connect to database' page with database prefix
- parent::clickContinueButton();
+ // From 'Connect to database' page with database prefix
+ parent::clickContinueButton();
- // To 'Complete' page
- parent::clickContinueButton();
- parent::completeNamePage();
- parent::clickContinueButton();
+ // To 'Complete' page
+ parent::clickContinueButton();
+ parent::completeNamePage();
+ parent::clickContinueButton();
- // Verify already installed warning message
- $this->assertEquals( "Install",
- $this->getText( LINK_DIV."h2" ));
- $this->assertEquals( "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
- $this->getText( LINK_FORM."div[1]" ));
+ // Verify already installed warning message
+ $this->assertEquals( "Install",
+ $this->getText( LINK_DIV . "h2" ) );
+ $this->assertEquals( "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
+ $this->getText( LINK_FORM . "div[1]" ) );
- parent::clickContinueButton();
- parent::completePageSuccessfull();
- $this->chooseCancelOnNextConfirmation();
- parent::restartInstallation();
- }
+ parent::clickContinueButton();
+ parent::completePageSuccessfull();
+ $this->chooseCancelOnNextConfirmation();
+ parent::restartInstallation();
+ }
}
*
*/
-
-require_once (__DIR__.'/'.'MediaWikiInstallationCommonFunction.php');
+require_once ( __DIR__ . '/' . 'MediaWikiInstallationCommonFunction.php' );
/**
* Test Case ID : 01 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
* Test Case Name : Install Mediawiki using 'MySQL' database type successfully
* Version : MediaWiki 1.18alpha
-*/
+ */
class MediaWikiMySQLDataBaseTestCase extends MediaWikiInstallationCommonFunction {
+ function setUp() {
+ parent::setUp();
+ }
- function setUp() {
- parent::setUp();
- }
-
- // Verify MediaWiki installation using 'MySQL' database type
- public function testMySQLDatabaseSuccess() {
-
- $databaseName = DB_NAME_PREFIX."_sql_db";
+ // Verify MediaWiki installation using 'MySQL' database type
+ public function testMySQLDatabaseSuccess() {
+ $databaseName = DB_NAME_PREFIX . "_sql_db";
- parent::navigateConnetToDatabasePage();
+ parent::navigateConnetToDatabasePage();
- // Verify 'MySQL" is selected as the default database type
- $this->assertEquals( "MySQL settings", $this->getText( "//div[@id='DB_wrapper_mysql']/h3" ));
+ // Verify 'MySQL" is selected as the default database type
+ $this->assertEquals( "MySQL settings", $this->getText( "//div[@id='DB_wrapper_mysql']/h3" ) );
- // Change 'Database name'
- $defaultDbName = $this->getText( "mysql_wgDBname" );
- $this->type( "mysql_wgDBname", " ");
- $this->type( "mysql_wgDBname", $databaseName );
- $this->assertNotEquals( $defaultDbName, $databaseName );
+ // Change 'Database name'
+ $defaultDbName = $this->getText( "mysql_wgDBname" );
+ $this->type( "mysql_wgDBname", " " );
+ $this->type( "mysql_wgDBname", $databaseName );
+ $this->assertNotEquals( $defaultDbName, $databaseName );
- // 'Database settings' page
- parent::clickContinueButton();
+ // 'Database settings' page
+ parent::clickContinueButton();
- // 'Name' page
- parent::clickContinueButton();
- parent::completeNamePage();
+ // 'Name' page
+ parent::clickContinueButton();
+ parent::completeNamePage();
- // 'Options page
- parent::clickContinueButton();
+ // 'Options page
+ parent::clickContinueButton();
- // 'Install' page
- parent::clickContinueButton();
+ // 'Install' page
+ parent::clickContinueButton();
- // 'Complete' page
- parent::completePageSuccessfull();
- parent::restartInstallation();
- }
+ // 'Complete' page
+ parent::completePageSuccessfull();
+ parent::restartInstallation();
+ }
}
*/
-require_once (__DIR__.'/'.'MediaWikiInstallationCommonFunction.php');
+require_once ( __DIR__ . '/' . 'MediaWikiInstallationCommonFunction.php' );
/**
* Test Case ID : 06 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
* Test Case Name : Install Mediawiki using 'MySQL' database type successfully
* Version : MediaWiki 1.18alpha
-*/
+ */
class MediaWikiMySQLiteDataBaseTestCase extends MediaWikiInstallationCommonFunction {
+ function setUp() {
+ parent::setUp();
+ }
- function setUp() {
- parent::setUp();
- }
-
- // Verify MediaWiki installation using 'MySQL' database type
- public function testMySQLDatabaseSuccess() {
-
- $databaseName = DB_NAME_PREFIX."_sqlite_db";
+ // Verify MediaWiki installation using 'MySQL' database type
+ public function testMySQLDatabaseSuccess() {
+ $databaseName = DB_NAME_PREFIX . "_sqlite_db";
- parent::navigateConnetToDatabasePage();
- $this->click( "DBType_sqlite" );
+ parent::navigateConnetToDatabasePage();
+ $this->click( "DBType_sqlite" );
- // Select 'SQLite' database type
- $this->assertEquals( "SQLite settings", $this->getText( "//div[@id='DB_wrapper_sqlite']/h3" ));
+ // Select 'SQLite' database type
+ $this->assertEquals( "SQLite settings", $this->getText( "//div[@id='DB_wrapper_sqlite']/h3" ) );
- // Change database name
- $defaultDbName = $this->getText( "sqlite_wgDBname" );
- $this->type( "sqlite_wgDBname", " ");
- $this->type( "sqlite_wgDBname", $databaseName );
- $this->assertNotEquals( $defaultDbName, $databaseName );
+ // Change database name
+ $defaultDbName = $this->getText( "sqlite_wgDBname" );
+ $this->type( "sqlite_wgDBname", " " );
+ $this->type( "sqlite_wgDBname", $databaseName );
+ $this->assertNotEquals( $defaultDbName, $databaseName );
- // 'Database settings' page
- parent::clickContinueButton();
+ // 'Database settings' page
+ parent::clickContinueButton();
- // 'Name' page
- parent::clickContinueButton();
- parent::completeNamePage();
+ // 'Name' page
+ parent::clickContinueButton();
+ parent::completeNamePage();
- // 'Options page
- parent::clickContinueButton();
+ // 'Options page
+ parent::clickContinueButton();
- // 'Install' page
- parent::clickContinueButton();
+ // 'Install' page
+ parent::clickContinueButton();
- // 'Complete' page
- parent::completePageSuccessfull();
- parent::restartInstallation();
- }
+ // 'Complete' page
+ parent::completePageSuccessfull();
+ parent::restartInstallation();
+ }
}
*/
-require_once (__DIR__.'/'.'MediaWikiInstallationCommonFunction.php');
+require_once ( __DIR__ . '/' . 'MediaWikiInstallationCommonFunction.php' );
/**
* Test Case ID : 03 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
* Test Case Name : Install mediawiki on a already installed Mediawiki.]
* Version : MediaWiki 1.18alpha
-*/
+ */
class MediaWikiOnAlreadyInstalledTestCase extends MediaWikiInstallationCommonFunction {
+ function setUp() {
+ parent::setUp();
+ }
- function setUp() {
- parent::setUp();
- }
-
- // Install Mediawiki using 'MySQL' database type.
- public function testInstallOnAlreadyInstalled() {
-
- $databaseName = DB_NAME_PREFIX."_already_installed";
- parent::navigateInstallPage( $databaseName );
+ // Install Mediawiki using 'MySQL' database type.
+ public function testInstallOnAlreadyInstalled() {
+ $databaseName = DB_NAME_PREFIX . "_already_installed";
+ parent::navigateInstallPage( $databaseName );
- // 'Options' page
- parent::clickBackButton();
+ // 'Options' page
+ parent::clickBackButton();
- // Install page
- parent::clickContinueButton();
+ // Install page
+ parent::clickContinueButton();
- // 'Install' page should display after the 'Option' page
- $this->assertEquals( "Install", $this->getText( LINK_DIV."h2" ));
+ // 'Install' page should display after the 'Option' page
+ $this->assertEquals( "Install", $this->getText( LINK_DIV . "h2" ) );
- // Verify warning text displayed
- $this->assertEquals( "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
- $this->getText( LINK_FORM."div[1]/div[2]" ));
+ // Verify warning text displayed
+ $this->assertEquals( "Warning: You seem to have already installed MediaWiki and are trying to install it again. Please proceed to the next page.",
+ $this->getText( LINK_FORM . "div[1]/div[2]" ) );
- // Complete page
- parent::clickContinueButton();
- parent::completePageSuccessfull();
- $this->chooseCancelOnNextConfirmation();
- parent::restartInstallation();
- }
+ // Complete page
+ parent::clickContinueButton();
+ parent::completePageSuccessfull();
+ $this->chooseCancelOnNextConfirmation();
+ parent::restartInstallation();
+ }
}
*/
-
-require_once (__DIR__.'/'.'MediaWikiInstallationCommonFunction.php');
+require_once ( __DIR__ . '/' . 'MediaWikiInstallationCommonFunction.php' );
/**
* Test Case ID : 11, 12 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
* Test Case Name : Install mediawiki on a already installed Mediawiki.
* Version : MediaWiki 1.18alpha
-*/
+ */
class MediaWikiRestartInstallationTestCase extends MediaWikiInstallationCommonFunction {
+ function setUp() {
+ parent::setUp();
+ }
- function setUp() {
- parent::setUp();
- }
-
- // Verify restarting the installation
- public function testSuccessRestartInstallation() {
-
- $dbNameBeforeRestart = DB_NAME_PREFIX."_db_before";
- parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart );
-
- // Verify 'Restart installation' link available
- $this->assertTrue($this->isElementPresent( "link=Restart installation" ));
-
- // Click 'Restart installation'
- $this->click( "link=Restart installation ");
- $this->waitForPageToLoad( PAGE_LOAD_TIME );
+ // Verify restarting the installation
+ public function testSuccessRestartInstallation() {
+ $dbNameBeforeRestart = DB_NAME_PREFIX . "_db_before";
+ parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart );
- // 'Restart Installation' page displayed
- $this->assertEquals( "Restart installation", $this->getText( LINK_DIV."h2"));
+ // Verify 'Restart installation' link available
+ $this->assertTrue( $this->isElementPresent( "link=Restart installation" ) );
- // Restart warning message displayed
- $this->assertTrue($this->isTextPresent( "exact:Do you want to clear all saved data that you have entered and restart the installation process?" ));
+ // Click 'Restart installation'
+ $this->click( "link=Restart installation " );
+ $this->waitForPageToLoad( PAGE_LOAD_TIME );
- // Click on the 'Yes, restart' button
- $this->click( "submit-restart" );
- $this->waitForPageToLoad( PAGE_LOAD_TIME );
+ // 'Restart Installation' page displayed
+ $this->assertEquals( "Restart installation", $this->getText( LINK_DIV . "h2" ) );
- // Navigate to the initial installation page(Language).
- $this->assertEquals( "Language", $this->getText( LINK_DIV."h2" ));
+ // Restart warning message displayed
+ $this->assertTrue( $this->isTextPresent( "exact:Do you want to clear all saved data that you have entered and restart the installation process?" ) );
- // 'Welcome to MediaWiki!' page
- parent::clickContinueButton();
+ // Click on the 'Yes, restart' button
+ $this->click( "submit-restart" );
+ $this->waitForPageToLoad( PAGE_LOAD_TIME );
- // 'Connect to database' page
- parent::clickContinueButton();
+ // Navigate to the initial installation page(Language).
+ $this->assertEquals( "Language", $this->getText( LINK_DIV . "h2" ) );
- // saved data should be deleted
- $dbNameAfterRestart = $this->getValue("mysql_wgDBname");
- $this->assertNotEquals($dbNameBeforeRestart, $dbNameAfterRestart);
- }
+ // 'Welcome to MediaWiki!' page
+ parent::clickContinueButton();
+ // 'Connect to database' page
+ parent::clickContinueButton();
- // Verify cancelling restart
- public function testCancelRestartInstallation() {
+ // saved data should be deleted
+ $dbNameAfterRestart = $this->getValue( "mysql_wgDBname" );
+ $this->assertNotEquals( $dbNameBeforeRestart, $dbNameAfterRestart );
+ }
- $dbNameBeforeRestart = DB_NAME_PREFIX."_cancel_restart";
+ // Verify cancelling restart
+ public function testCancelRestartInstallation() {
+ $dbNameBeforeRestart = DB_NAME_PREFIX . "_cancel_restart";
- parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart);
- // Verify 'Restart installation' link available
- $this->assertTrue($this->isElementPresent( "link=Restart installation" ));
+ parent::navigateDatabaseSettingsPage( $dbNameBeforeRestart );
+ // Verify 'Restart installation' link available
+ $this->assertTrue( $this->isElementPresent( "link=Restart installation" ) );
- $this->click( "link=Restart installation" );
- $this->waitForPageToLoad( PAGE_LOAD_TIME );
+ $this->click( "link=Restart installation" );
+ $this->waitForPageToLoad( PAGE_LOAD_TIME );
- // 'Restart Installation' page displayed
- $this->assertEquals( "Restart installation", $this->getText( LINK_DIV."h2" ));
+ // 'Restart Installation' page displayed
+ $this->assertEquals( "Restart installation", $this->getText( LINK_DIV . "h2" ) );
- // Restart warning message displayed
- $this->assertTrue( $this->isTextPresent( "Do you want to clear all saved data that you have entered and restart the installation process?"));
+ // Restart warning message displayed
+ $this->assertTrue( $this->isTextPresent( "Do you want to clear all saved data that you have entered and restart the installation process?" ) );
- // Click on the 'Back' button
- parent::clickBackButton();
+ // Click on the 'Back' button
+ parent::clickBackButton();
- // Navigates to the previous page
- $this->assertEquals( "Database settings", $this->getText( LINK_DIV."h2" ));
+ // Navigates to the previous page
+ $this->assertEquals( "Database settings", $this->getText( LINK_DIV . "h2" ) );
- // 'Connect to database' page
- parent::clickBackButton();
+ // 'Connect to database' page
+ parent::clickBackButton();
- // Saved data remain on the page.
- $dbNameAfterRestart = $this->getValue( "mysql_wgDBname" );
- $this->assertEquals( $dbNameBeforeRestart, $dbNameAfterRestart );
- }
+ // Saved data remain on the page.
+ $dbNameAfterRestart = $this->getValue( "mysql_wgDBname" );
+ $this->assertEquals( $dbNameBeforeRestart, $dbNameAfterRestart );
+ }
}
*
*/
-
-require_once (__DIR__.'/'.'MediaWikiInstallationCommonFunction.php');
+require_once ( __DIR__ . '/' . 'MediaWikiInstallationCommonFunction.php' );
/**
* Test Case ID : 14, 15, 16, 17 (http://www.mediawiki.org/wiki/New_installer/Test_plan)
* User selects 'Copying' link.
* User selects 'Upgrading' link.
* Version : MediaWiki 1.18alpha
-*/
-
+ */
class MediaWikiRightFrameworkLinksTestCase extends MediaWikiInstallationCommonFunction {
-
- function setUp() {
- parent::setUp();
- }
-
- public function testLinksAvailability() {
-
- $this->open( "http://".HOST_NAME.":".PORT."/".DIRECTORY_NAME."/config/index.php" );
-
- // Verify 'Read me' link availability
- $this->assertTrue($this->isElementPresent( "link=Read me" ));
-
- // Verify 'Release notes' link availability
- $this->assertTrue($this->isElementPresent( "link=Release notes" ));
-
- // Verify 'Copying' link availability
- $this->assertTrue($this->isElementPresent( "link=Copying" ));
- }
-
- public function testPageNavigation() {
-
- $this->open( "http://".HOST_NAME.":".PORT."/".DIRECTORY_NAME."/config/index.php" );
-
- // Navigate to the 'Read me' page
- $this->click( "link=Read me" );
- $this->waitForPageToLoad( PAGE_LOAD_TIME );
- $this->assertEquals( "Read me", $this->getText( LINK_DIV."h2[1]" ));
- $this->assertTrue($this->isElementPresent( "submit-back" ));
- parent::clickBackButton();
-
- // Navigate to the 'Release notes' page
- $this->click( "link=Release notes" );
- $this->waitForPageToLoad( PAGE_LOAD_TIME);
- $this->assertEquals( "Release notes", $this->getText( LINK_DIV."h2[1]" ));
- $this->assertTrue( $this->isElementPresent( "submit-back" ));
- parent::clickBackButton();
-
- // Navigate to the 'Copying' page
- $this->click( "link=Copying" );
- $this->waitForPageToLoad( PAGE_LOAD_TIME );
- $this->assertEquals( "Copying", $this->getText( LINK_DIV."h2[1]" ));
- $this->assertTrue($this->isElementPresent( "submit-back" ));
- parent::clickBackButton();
-
- // Navigate to the 'Upgrading' page
- $this->click( "link=Upgrading" );
- $this->waitForPageToLoad( PAGE_LOAD_TIME );
- $this->assertEquals( "Upgrading", $this->getText( LINK_DIV."h2[1]" ));
- }
+ function setUp() {
+ parent::setUp();
+ }
+
+ public function testLinksAvailability() {
+ $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
+
+ // Verify 'Read me' link availability
+ $this->assertTrue( $this->isElementPresent( "link=Read me" ) );
+
+ // Verify 'Release notes' link availability
+ $this->assertTrue( $this->isElementPresent( "link=Release notes" ) );
+
+ // Verify 'Copying' link availability
+ $this->assertTrue( $this->isElementPresent( "link=Copying" ) );
+ }
+
+ public function testPageNavigation() {
+ $this->open( "http://" . HOST_NAME . ":" . PORT . "/" . DIRECTORY_NAME . "/config/index.php" );
+
+ // Navigate to the 'Read me' page
+ $this->click( "link=Read me" );
+ $this->waitForPageToLoad( PAGE_LOAD_TIME );
+ $this->assertEquals( "Read me", $this->getText( LINK_DIV . "h2[1]" ) );
+ $this->assertTrue( $this->isElementPresent( "submit-back" ) );
+ parent::clickBackButton();
+
+ // Navigate to the 'Release notes' page
+ $this->click( "link=Release notes" );
+ $this->waitForPageToLoad( PAGE_LOAD_TIME );
+ $this->assertEquals( "Release notes", $this->getText( LINK_DIV . "h2[1]" ) );
+ $this->assertTrue( $this->isElementPresent( "submit-back" ) );
+ parent::clickBackButton();
+
+ // Navigate to the 'Copying' page
+ $this->click( "link=Copying" );
+ $this->waitForPageToLoad( PAGE_LOAD_TIME );
+ $this->assertEquals( "Copying", $this->getText( LINK_DIV . "h2[1]" ) );
+ $this->assertTrue( $this->isElementPresent( "submit-back" ) );
+ parent::clickBackButton();
+
+ // Navigate to the 'Upgrading' page
+ $this->click( "link=Upgrading" );
+ $this->waitForPageToLoad( PAGE_LOAD_TIME );
+ $this->assertEquals( "Upgrading", $this->getText( LINK_DIV . "h2[1]" ) );
+ }
}
* @file
* @ingroup Testing
* Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
- * http://www.calcey.com/
+ * http://www.calcey.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
*/
-
class AddNewPageTestCase extends SeleniumTestCase {
-
- // Verify adding a new page
- public function testAddNewPage() {
- $newPage = "new";
- $displayName = "New";
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->type( "searchInput", $newPage );
- $this->click( "searchGoButton" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
-
- // Verify 'Search results' text available
- $source = $this->gettext( "firstHeading" );
- $correct = strstr( $source, "Search results" );
- $this->assertEquals( $correct, true);
-
- // Verify 'Create the page "<page name>" on this wiki' text available
- $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
- $correct = strstr ( $source, "Create the page \"New\" on this wiki!" );
- $this->assertEquals( $correct, true );
-
- $this->click( SeleniumTestConstants::LINK_START.$displayName );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
-
- $this->assertTrue($this->isElementPresent( SeleniumTestConstants::LINK_START."Create" ));
- $this->type( "wpTextbox1", "add new test page" );
- $this->click( SeleniumTestConstants::BUTTON_SAVE );
-
- // Verify new page added
- $source = $this->gettext( "firstHeading" );
- $correct = strstr ( $source, $displayName );
- $this->assertEquals( $correct, true );
- }
+ // Verify adding a new page
+ public function testAddNewPage() {
+ $newPage = "new";
+ $displayName = "New";
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->type( "searchInput", $newPage );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify 'Search results' text available
+ $source = $this->gettext( "firstHeading" );
+ $correct = strstr( $source, "Search results" );
+ $this->assertEquals( $correct, true );
+
+ // Verify 'Create the page "<page name>" on this wiki' text available
+ $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
+ $correct = strstr( $source, "Create the page \"New\" on this wiki!" );
+ $this->assertEquals( $correct, true );
+
+ $this->click( SeleniumTestConstants::LINK_START . $displayName );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->assertTrue( $this->isElementPresent( SeleniumTestConstants::LINK_START . "Create" ) );
+ $this->type( "wpTextbox1", "add new test page" );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+
+ // Verify new page added
+ $source = $this->gettext( "firstHeading" );
+ $correct = strstr( $source, $displayName );
+ $this->assertEquals( $correct, true );
+ }
}
* @file
* @ingroup Testing
* Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
- * http://www.calcey.com/
+ * http://www.calcey.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
*/
-
class DeletePageAdminTestCase extends SeleniumTestCase {
+ // Verify adding a new page
+ public function testDeletePage() {
- // Verify adding a new page
- public function testDeletePage() {
-
-
- $newPage = "new";
- $displayName = "New";
+ $newPage = "new";
+ $displayName = "New";
- $this->open( $this->getUrl().'/index.php?title=Main_Page' );
+ $this->open( $this->getUrl() . '/index.php?title=Main_Page' );
- $this->type( "searchInput", $newPage );
- $this->click( "searchGoButton" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->click( SeleniumTestConstants::LINK_START.$displayName );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->type( SeleniumTestConstants::TEXT_EDITOR, $newPage." text" );
- $this->click( SeleniumTestConstants::BUTTON_SAVE );
+ $this->type( "searchInput", $newPage );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( SeleniumTestConstants::LINK_START . $displayName );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, $newPage . " text" );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->click( SeleniumTestConstants::LINK_START."Log out" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->click( SeleniumTestConstants::LINK_START."Log in / create account" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( SeleniumTestConstants::LINK_START . "Log out" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( SeleniumTestConstants::LINK_START . "Log in / create account" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->type( "wpName1", $this->selenium->getUser() );
- $this->type( "wpPassword1", $this->selenium->getPass() );
- $this->click( "wpLoginAttempt" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->type( "searchInput", "new" );
- $this->click( "searchGoButton");
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->type( "wpName1", $this->selenium->getUser() );
+ $this->type( "wpPassword1", $this->selenium->getPass() );
+ $this->click( "wpLoginAttempt" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->type( "searchInput", "new" );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- // Verify 'Delete' link displayed
- $source = $this->gettext( SeleniumTestConstants::LINK_START."Delete" );
- $correct = strstr ( $source, "Delete" );
- $this->assertEquals($correct, true );
+ // Verify 'Delete' link displayed
+ $source = $this->gettext( SeleniumTestConstants::LINK_START . "Delete" );
+ $correct = strstr( $source, "Delete" );
+ $this->assertEquals( $correct, true );
- $this->click( SeleniumTestConstants::LINK_START."Delete" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( SeleniumTestConstants::LINK_START . "Delete" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- // Verify 'Delete' button available
- $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
+ // Verify 'Delete' button available
+ $this->assertTrue( $this->isElementPresent( "wpConfirmB" ) );
- $this->click( "wpConfirmB" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( "wpConfirmB" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- // Verify 'Action complete' text displayed
- $source = $this->gettext( "firstHeading" );
- $correct = strstr ( $source, "Action complete" );
- $this->assertEquals( $correct, true );
+ // Verify 'Action complete' text displayed
+ $source = $this->gettext( "firstHeading" );
+ $correct = strstr( $source, "Action complete" );
+ $this->assertEquals( $correct, true );
- // Verify '<Page Name> has been deleted. See deletion log for a record of recent deletions.' text displayed
- $source = $this->gettext( "//div[@id='bodyContent']/p[1]" );
- $correct = strstr ( $source, "\"New\" has been deleted. See deletion log for a record of recent deletions." );
- $this->assertEquals( $correct, true );
- }
+ // Verify '<Page Name> has been deleted. See deletion log for a record of recent deletions.' text displayed
+ $source = $this->gettext( "//div[@id='bodyContent']/p[1]" );
+ $correct = strstr( $source, "\"New\" has been deleted. See deletion log for a record of recent deletions." );
+ $this->assertEquals( $correct, true );
+ }
}
* @file
* @ingroup Testing
* Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
- * http://www.calcey.com/
+ * http://www.calcey.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
class EmailPasswordTestCase extends SeleniumTestCase {
-
- // change user name for each and every test (with in 24 hours)
- private $userName = "test1";
-
- public function testEmailPasswordButton() {
-
- $this->click( SeleniumTestConstants::LINK_START."Log out" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
-
- $this->open( $this->getUrl().'/index.php?title=Main_Page' );
-
- // click Log in / create account link to open Log in / create account' page
- $this->click( SeleniumTestConstants::LINK_START."Log in / create account" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->assertTrue($this->isElementPresent( "wpMailmypassword" ));
- }
-
- // Verify Email password functionality
- public function testEmailPasswordMessages() {
-
- $this->click( SeleniumTestConstants::LINK_START."Log out" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
-
- $this->open( $this->getUrl().'/index.php?title=Main_Page' );
-
- // click Log in / create account link to open Log in / create account' page
- $this->click( SeleniumTestConstants::LINK_START."Log in / create account" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
-
- $this->type( "wpName1", "" );
- $this->click( "wpMailmypassword" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->assertEquals( "Login error\n You have not specified a valid user name.",
- $this->getText("//div[@id='bodyContent']/div[4]"));
-
- $this->type( "wpName1", $this->userName );
- $this->click( "wpMailmypassword" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
-
- // Can not run on localhost
- $this->assertEquals( "A new password has been sent to the e-mail address registered for ".ucfirst($this->userName).". Please log in again after you receive it.",
- $this->getText("//div[@id='bodyContent']/div[4]" ));
-
- $this->type( "wpName1", $this->userName );
- $this->click( "wpMailmypassword" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->assertEquals( "Login error\n A password reminder has already been sent, within the last 24 hours. To prevent abuse, only one password reminder will be sent per 24 hours.",
- $this->getText( "//div[@id='bodyContent']/div[4]" ));
- }
+ // change user name for each and every test (with in 24 hours)
+ private $userName = "test1";
+
+ public function testEmailPasswordButton() {
+ $this->click( SeleniumTestConstants::LINK_START . "Log out" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->open( $this->getUrl() . '/index.php?title=Main_Page' );
+
+ // click Log in / create account link to open Log in / create account' page
+ $this->click( SeleniumTestConstants::LINK_START . "Log in / create account" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->assertTrue( $this->isElementPresent( "wpMailmypassword" ) );
+ }
+
+ // Verify Email password functionality
+ public function testEmailPasswordMessages() {
+ $this->click( SeleniumTestConstants::LINK_START . "Log out" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->open( $this->getUrl() . '/index.php?title=Main_Page' );
+
+ // click Log in / create account link to open Log in / create account' page
+ $this->click( SeleniumTestConstants::LINK_START . "Log in / create account" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->type( "wpName1", "" );
+ $this->click( "wpMailmypassword" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( "Login error\n You have not specified a valid user name.",
+ $this->getText( "//div[@id='bodyContent']/div[4]" ) );
+
+ $this->type( "wpName1", $this->userName );
+ $this->click( "wpMailmypassword" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Can not run on localhost
+ $this->assertEquals( "A new password has been sent to the e-mail address registered for " . ucfirst( $this->userName ) . ". Please log in again after you receive it.",
+ $this->getText( "//div[@id='bodyContent']/div[4]" ) );
+
+ $this->type( "wpName1", $this->userName );
+ $this->click( "wpMailmypassword" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( "Login error\n A password reminder has already been sent, within the last 24 hours. To prevent abuse, only one password reminder will be sent per 24 hours.",
+ $this->getText( "//div[@id='bodyContent']/div[4]" ) );
+ }
}
<?php
class MediaWikiEditorTestSuite extends SeleniumTestSuite {
- public function setUp() {
- $this->setLoginBeforeTests( true );
- parent::setUp();
- }
- public function addTests() {
- $testFiles = array(
- 'tests/selenium/suites/AddNewPageTestCase.php',
- 'tests/selenium/suites/AddContentToNewPageTestCase.php',
- 'tests/selenium/suites/PreviewPageTestCase.php',
- 'tests/selenium/suites/SavePageTestCase.php',
- );
- parent::addTestFiles( $testFiles );
- }
+ public function setUp() {
+ $this->setLoginBeforeTests( true );
+ parent::setUp();
+ }
+
+ public function addTests() {
+ $testFiles = array(
+ 'tests/selenium/suites/AddNewPageTestCase.php',
+ 'tests/selenium/suites/AddContentToNewPageTestCase.php',
+ 'tests/selenium/suites/PreviewPageTestCase.php',
+ 'tests/selenium/suites/SavePageTestCase.php',
+ );
+ parent::addTestFiles( $testFiles );
+ }
}
* @file
* @ingroup Testing
* Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
- * http://www.calcey.com/
+ * http://www.calcey.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
require_once dirname( __DIR__ ) . '/SeleniumTestConstants.php';
class MyContributionsTestCase extends SeleniumTestCase {
+ // Verify user contributions
+ public function testRecentChangesAvailability() {
+ $newPage = $this->createNewTestPage( "MyContributionsTest" );
- // Verify user contributions
- public function testRecentChangesAvailability() {
+ // Verify My contributions Link available
+ $this->assertTrue( $this->isElementPresent( "link=Contributions" ) );
- $newPage = $this->createNewTestPage( "MyContributionsTest" );
-
- // Verify My contributions Link available
- $this->assertTrue($this->isElementPresent( "link=Contributions" ));
-
- $this->click( "link=Contributions" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( "link=Contributions" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- // Verify recent page adding available on My Contributions list
- $this->assertEquals( $newPage, $this->getText( "link=".$newPage ));
+ // Verify recent page adding available on My Contributions list
+ $this->assertEquals( $newPage, $this->getText( "link=" . $newPage ) );
- $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, $newPage );
- $this->click( SeleniumTestConstants::BUTTON_SEARCH );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
-
- $this->click( SeleniumTestConstants::LINK_EDIT );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->type( SeleniumTestConstants::TEXT_EDITOR, $newPage . " text changed" );
- $this->click( SeleniumTestConstants::BUTTON_SAVE );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->click( "link=Contributions" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, $newPage );
+ $this->click( SeleniumTestConstants::BUTTON_SEARCH );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- // Verify recent page changes available on My Contributions
- $this->assertTrue( $this->isTextPresent( $newPage ) );
- }
+ $this->click( SeleniumTestConstants::LINK_EDIT );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, $newPage . " text changed" );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( "link=Contributions" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify recent page changes available on My Contributions
+ $this->assertTrue( $this->isTextPresent( $newPage ) );
+ }
}
* @file
* @ingroup Testing
* Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
- * http://www.calcey.com/
+ * http://www.calcey.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
require_once dirname( __DIR__ ) . '/SeleniumTestConstants.php';
class MyWatchListTestCase extends SeleniumTestCase {
-
- // Verify user watchlist
- public function testMyWatchlist() {
-
- $pageName = $this->createNewTestPage( "MyWatchListTest", true );
- // Verify link 'My Watchlist' available
- $this->assertTrue( $this->isElementPresent( SeleniumTestConstants::LINK_START."Watchlist" ) );
-
- $this->click( SeleniumTestConstants::LINK_START."Watchlist" );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
-
- // Verify newly added page to the watchlist is available
- $this->assertEquals( $pageName, $this->getText( SeleniumTestConstants::LINK_START.$pageName ));
-
- $this->click( SeleniumTestConstants::LINK_START.$pageName );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->click( SeleniumTestConstants::LINK_EDIT );
- $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
- $this->click( "wpWatchthis" );
- $this->click( SeleniumTestConstants::BUTTON_SAVE );
- $this->assertFalse( $this->isElementPresent( SeleniumTestConstants::LINK_START.$pageName ) );
- //todo watch using the dropdown menu
- }
+ // Verify user watchlist
+ public function testMyWatchlist() {
+ $pageName = $this->createNewTestPage( "MyWatchListTest", true );
+ // Verify link 'My Watchlist' available
+ $this->assertTrue( $this->isElementPresent( SeleniumTestConstants::LINK_START . "Watchlist" ) );
+
+ $this->click( SeleniumTestConstants::LINK_START . "Watchlist" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify newly added page to the watchlist is available
+ $this->assertEquals( $pageName, $this->getText( SeleniumTestConstants::LINK_START . $pageName ) );
+
+ $this->click( SeleniumTestConstants::LINK_START . $pageName );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( SeleniumTestConstants::LINK_EDIT );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( "wpWatchthis" );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+ $this->assertFalse( $this->isElementPresent( SeleniumTestConstants::LINK_START . $pageName ) );
+ //todo watch using the dropdown menu
+ }
}
* @file
* @ingroup Testing
* Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
- * http://www.calcey.com/
+ * http://www.calcey.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
class PreviewPageTestCase extends SeleniumTestCase {
+ // Verify adding a new page
+ public function testPreviewPage() {
+ $wikiText = "Adding this page to test the \n Preview button functionality";
+ $newPage = "Test Preview Page";
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->getNewPage( $newPage );
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, $wikiText . "" );
+ $this->assertTrue( $this->isElementPresent( "//*[@id='wpPreview']" ) );
- // Verify adding a new page
- public function testPreviewPage() {
- $wikiText = "Adding this page to test the \n Preview button functionality";
- $newPage = "Test Preview Page";
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->getNewPage( $newPage );
- $this->type( SeleniumTestConstants::TEXT_EDITOR, $wikiText."" );
- $this->assertTrue($this->isElementPresent( "//*[@id='wpPreview']" ));
+ $this->click( "wpPreview" );
- $this->click( "wpPreview" );
+ // Verify saved page available
+ $source = $this->gettext( "firstHeading" );
+ $correct = strstr( $source, "Test Preview Page" );
+ $this->assertEquals( $correct, true );
- // Verify saved page available
- $source = $this->gettext( "firstHeading" );
- $correct = strstr( $source, "Test Preview Page" );
- $this->assertEquals( $correct, true);
-
- // Verify page content previewed succesfully
- $contentOfPreviewPage = $this->getText( "//*[@id='content']" );
- $this->assertContains( $wikiText, $contentOfPreviewPage );
- }
+ // Verify page content previewed succesfully
+ $contentOfPreviewPage = $this->getText( "//*[@id='content']" );
+ $this->assertContains( $wikiText, $contentOfPreviewPage );
+ }
}
* @file
* @ingroup Testing
* Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
- * http://www.calcey.com/
+ * http://www.calcey.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
class SavePageTestCase extends SeleniumTestCase {
-
- // Verify adding a new page
- public function testSavePage() {
- $wikiText = "Adding this page to test the Save button functionality";
- $newPage = "Test Save Page";
-
- $this->open( $this->getUrl() .
- '/index.php?title=Main_Page&action=edit' );
- $this->getNewPage($newPage);
- $this->type( SeleniumTestConstants::TEXT_EDITOR, $wikiText );
-
- // verify 'Save' button available
- $this->assertTrue($this->isElementPresent( SeleniumTestConstants::BUTTON_SAVE ));
- $this->click( SeleniumTestConstants::BUTTON_SAVE );
-
- // Verify saved page available
- $source = $this->gettext( "firstHeading" );
- $correct = strstr( $source, "Test Save Page" );
-
- // Verify Saved page name displayed correctly
- $this->assertEquals( $correct, true );
-
- // Verify page content saved succesfully
- $contentOfSavedPage = $this->getText( "//*[@id='content']" );
- $this->assertContains( $wikiText, $contentOfSavedPage );
- $this->deletePage( $newPage );
- }
+ // Verify adding a new page
+ public function testSavePage() {
+ $wikiText = "Adding this page to test the Save button functionality";
+ $newPage = "Test Save Page";
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->getNewPage( $newPage );
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, $wikiText );
+
+ // verify 'Save' button available
+ $this->assertTrue( $this->isElementPresent( SeleniumTestConstants::BUTTON_SAVE ) );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+
+ // Verify saved page available
+ $source = $this->gettext( "firstHeading" );
+ $correct = strstr( $source, "Test Save Page" );
+
+ // Verify Saved page name displayed correctly
+ $this->assertEquals( $correct, true );
+
+ // Verify page content saved succesfully
+ $contentOfSavedPage = $this->getText( "//*[@id='content']" );
+ $this->assertContains( $wikiText, $contentOfSavedPage );
+ $this->deletePage( $newPage );
+ }
}
<?php
class SimpleSeleniumConfig {
-
- public static function getSettings(&$includeFiles, &$globalConfigs, &$resourceFiles) {
+
+ public static function getSettings( &$includeFiles, &$globalConfigs, &$resourceFiles ) {
global $IP;
$includes = array(
//files that needed to be included would go here
);
$configs = array(
- 'wgDBprefix' => 'mw_',
- 'wgDBTableOptions' => 'ENGINE=InnoDB, DEFAULT CHARSET=binary',
- 'wgDBmysql5' => 'false',
- 'wgMainCacheType' => 'CACHE_NONE',
+ 'wgDBprefix' => 'mw_',
+ 'wgDBTableOptions' => 'ENGINE=InnoDB, DEFAULT CHARSET=binary',
+ 'wgDBmysql5' => 'false',
+ 'wgMainCacheType' => 'CACHE_NONE',
'wgParserCacheType' => 'CACHE_NONE',
- 'wgMemCachedServers'=> array(),
- 'wgLanguageCode' => 'en',
- 'wgSitename' => 'test_wiki',
- 'wgDefaultSkin' => 'chick'
+ 'wgMemCachedServers' => array(),
+ 'wgLanguageCode' => 'en',
+ 'wgSitename' => 'test_wiki',
+ 'wgDefaultSkin' => 'chick'
);
$resources = array(
'db' => "$IP/tests/selenium/data/SimpleSeleniumTestDB.sql",
'images' => "$IP/tests/selenium/data/SimpleSeleniumTestImages.zip"
);
-
+
$includeFiles = array_merge( $includeFiles, $includes );
- $globalConfigs = array_merge( $globalConfigs, $configs);
+ $globalConfigs = array_merge( $globalConfigs, $configs );
$resourceFiles = array_merge( $resourceFiles, $resources );
- return true;
+ return true;
}
-}
\ No newline at end of file
+}