r65717 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65716‎ | r65717 | r65718 >
Date:22:06, 30 April 2010
Author:ashley
Status:ok
Tags:
Comment:
follow-up to r65715: convert spaces to tabs for indentation, as per our coding standards. no functional changes.
Modified paths:
  • /trunk/phase3/maintenance/tests/selenium/Selenium.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/SeleniumTestCase.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/SeleniumTestConsoleLogger.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/SeleniumTestHTMLLogger.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/SeleniumTestListener.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/SeleniumTestSuite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/selenium/SeleniumTestSuite.php
@@ -11,30 +11,30 @@
1212
1313 class SeleniumTestSuite extends PHPUnit_Framework_TestSuite
1414 {
15 - private $selenium;
 15+ private $selenium;
1616
17 - public function setUp()
18 - {
 17+ public function setUp()
 18+ {
1919
20 - $this->selenium = Selenium::getInstance();
21 - $this->selenium->start();
22 - $this->login();
23 - //$this->loadPage('Testpage', 'edit');
24 - }
 20+ $this->selenium = Selenium::getInstance();
 21+ $this->selenium->start();
 22+ $this->login();
 23+ //$this->loadPage('Testpage', 'edit');
 24+ }
2525
26 - public function tearDown()
27 - {
28 - $this->selenium->stop();
29 - }
 26+ public function tearDown()
 27+ {
 28+ $this->selenium->stop();
 29+ }
3030
31 - public function login()
32 - {
33 - $this->selenium->login();
34 - }
 31+ public function login()
 32+ {
 33+ $this->selenium->login();
 34+ }
3535
36 - public function loadPage($title, $action)
37 - {
38 - $this->selenium->loadPage($title, $action);
39 - }
 36+ public function loadPage($title, $action)
 37+ {
 38+ $this->selenium->loadPage($title, $action);
 39+ }
4040 }
4141
Index: trunk/phase3/maintenance/tests/selenium/SeleniumTestCase.php
@@ -6,37 +6,37 @@
77
88 class SeleniumTestCase extends PHPUnit_Framework_TestCase //PHPUnit_Extensions_SeleniumTestCase
99 {
10 - protected $selenium;
 10+ protected $selenium;
1111
12 - public function setUp()
13 - {
14 - set_time_limit(60);
15 - $this->selenium = Selenium::getInstance();
16 - //print_r($this->suite);
17 - }
 12+ public function setUp()
 13+ {
 14+ set_time_limit(60);
 15+ $this->selenium = Selenium::getInstance();
 16+ //print_r($this->suite);
 17+ }
1818
19 - public function tearDown()
20 - {
 19+ public function tearDown()
 20+ {
2121
22 - }
 22+ }
2323
24 - public function __call($method, $args)
25 - {
26 - return call_user_func_array (array($this->selenium, $method), $args);
27 - }
 24+ public function __call($method, $args)
 25+ {
 26+ return call_user_func_array (array($this->selenium, $method), $args);
 27+ }
2828
29 - public function assertSeleniumAttributeEquals($attribute, $value)
30 - {
31 - $attr = $this->getAttribute($attribute);
32 - $this->assertEquals($attr, $value);
33 - }
 29+ public function assertSeleniumAttributeEquals($attribute, $value)
 30+ {
 31+ $attr = $this->getAttribute($attribute);
 32+ $this->assertEquals($attr, $value);
 33+ }
3434
35 - public function assertSeleniumHTMLContains($element, $text)
36 - {
37 - $innerHTML = $this->getText($element);
38 - //or assertContains
39 - $this->assertRegExp("/$text/", $innerHTML );
40 - }
 35+ public function assertSeleniumHTMLContains($element, $text)
 36+ {
 37+ $innerHTML = $this->getText($element);
 38+ //or assertContains
 39+ $this->assertRegExp("/$text/", $innerHTML );
 40+ }
4141
4242 }
4343
Index: trunk/phase3/maintenance/tests/selenium/Selenium.php
@@ -11,50 +11,50 @@
1212
1313 class Selenium extends Testing_Selenium
1414 {
15 - protected static $_instance = null;
16 - public $isStarted = false;
17 - public static function getInstance()
18 - {
19 - global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost, $wgSeleniumTestsUseBrowser;
20 - if (null === self::$_instance)
21 - {
22 - self::$_instance = new self($wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser], $wgSeleniumTestsSeleniumHost);
23 - }
24 - return self::$_instance;
25 - }
 15+ protected static $_instance = null;
 16+ public $isStarted = false;
 17+ public static function getInstance()
 18+ {
 19+ global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost, $wgSeleniumTestsUseBrowser;
 20+ if (null === self::$_instance)
 21+ {
 22+ self::$_instance = new self($wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser], $wgSeleniumTestsSeleniumHost);
 23+ }
 24+ return self::$_instance;
 25+ }
2626
27 - public function start()
28 - {
29 - global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost;
30 - parent::start();
31 - $this->isStarted = true;
32 - }
 27+ public function start()
 28+ {
 29+ global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost;
 30+ parent::start();
 31+ $this->isStarted = true;
 32+ }
3333
34 - public function stop()
35 - {
36 - parent::stop();
37 - $this->isStarted = false;
38 - }
 34+ public function stop()
 35+ {
 36+ parent::stop();
 37+ $this->isStarted = false;
 38+ }
3939
40 - public function login()
41 - {
42 - global $wgSeleniumTestsWikiUser, $wgSeleniumTestsWikiPassword, $wgSeleniumTestsWikiUrl;
 40+ public function login()
 41+ {
 42+ global $wgSeleniumTestsWikiUser, $wgSeleniumTestsWikiPassword, $wgSeleniumTestsWikiUrl;
4343
44 - $this->open($wgSeleniumTestsWikiUrl.'/index.php?title=Special:Userlogin');
45 - $this->type("wpName1", $wgSeleniumTestsWikiUser);
46 - $this->type("wpPassword1", $wgSeleniumTestsWikiPassword);
47 - $this->click("//input[@id='wpLoginAttempt']");
48 - $value = $this->doCommand('assertTitle', array('Anmeldung erfolgreich*'));
49 - }
 44+ $this->open($wgSeleniumTestsWikiUrl.'/index.php?title=Special:Userlogin');
 45+ $this->type("wpName1", $wgSeleniumTestsWikiUser);
 46+ $this->type("wpPassword1", $wgSeleniumTestsWikiPassword);
 47+ $this->click("//input[@id='wpLoginAttempt']");
 48+ $value = $this->doCommand('assertTitle', array('Anmeldung erfolgreich*'));
 49+ }
5050
51 - public function loadPage($title, $action)
52 - {
53 - global $wgSeleniumTestsWikiUrl;
54 - $this->open($wgSeleniumTestsWikiUrl.'/index.php?title='.$title.'&action='.$action);
55 - }
 51+ public function loadPage($title, $action)
 52+ {
 53+ global $wgSeleniumTestsWikiUrl;
 54+ $this->open($wgSeleniumTestsWikiUrl.'/index.php?title='.$title.'&action='.$action);
 55+ }
5656
57 - // Prevent external cloning
58 - protected function __clone() {}
59 - // Prevent external construction
60 - //protected function __construct() {}
 57+ // Prevent external cloning
 58+ protected function __clone() {}
 59+ // Prevent external construction
 60+ //protected function __construct() {}
6161 }
Index: trunk/phase3/maintenance/tests/selenium/SeleniumTestConsoleLogger.php
@@ -6,24 +6,24 @@
77
88 class SeleniumTestConsoleLogger
99 {
10 - public function __construct()
11 - {
12 - // Prepare testsuite for immediate output
13 - @ini_set('zlib.output_compression', 0);
14 - @ini_set('implicit_flush', 1);
15 - for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
16 - ob_implicit_flush(1);
17 -
18 - }
 10+ public function __construct()
 11+ {
 12+ // Prepare testsuite for immediate output
 13+ @ini_set('zlib.output_compression', 0);
 14+ @ini_set('implicit_flush', 1);
 15+ for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
 16+ ob_implicit_flush(1);
 17+
 18+ }
1919
20 - public function write($message, $mode = false)
21 - {
22 - $out .= '';
23 - //if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '<font color="green">';
24 - $out .= htmlentities($message);
25 - //if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '</font>';
26 - if ($mode != MW_TESTLOGGER_CONTINUE_LINE) $out .= "\n";
 20+ public function write($message, $mode = false)
 21+ {
 22+ $out .= '';
 23+ //if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '<font color="green">';
 24+ $out .= htmlentities($message);
 25+ //if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '</font>';
 26+ if ($mode != MW_TESTLOGGER_CONTINUE_LINE) $out .= "\n";
2727
28 - echo $out;
29 - }
 28+ echo $out;
 29+ }
3030 }
\ No newline at end of file
Index: trunk/phase3/maintenance/tests/selenium/SeleniumTestHTMLLogger.php
@@ -6,38 +6,38 @@
77
88 class SeleniumTestHTMLLogger
99 {
10 - public function __construct()
11 - {
12 - // Prepare testsuite for immediate output
13 - @ini_set('zlib.output_compression', 0);
14 - @ini_set('implicit_flush', 1);
15 - for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
16 - ob_implicit_flush(1);
17 -
18 - // Output some style information
19 - echo '<style>
20 - pre {
21 - overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */
22 - white-space: pre-wrap; /* css-3 */
23 - white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
24 - white-space: -pre-wrap; /* Opera 4-6 */
25 - white-space: -o-pre-wrap; /* Opera 7 */
26 - /* width: 99%; */
27 - word-wrap: break-word; /* Internet Explorer 5.5+ */
28 - }
29 - </style>';
30 -
31 -
32 - }
 10+ public function __construct()
 11+ {
 12+ // Prepare testsuite for immediate output
 13+ @ini_set('zlib.output_compression', 0);
 14+ @ini_set('implicit_flush', 1);
 15+ for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
 16+ ob_implicit_flush(1);
 17+
 18+ // Output some style information
 19+ echo '<style>
 20+ pre {
 21+ overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */
 22+ white-space: pre-wrap; /* css-3 */
 23+ white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
 24+ white-space: -pre-wrap; /* Opera 4-6 */
 25+ white-space: -o-pre-wrap; /* Opera 7 */
 26+ /* width: 99%; */
 27+ word-wrap: break-word; /* Internet Explorer 5.5+ */
 28+ }
 29+ </style>';
 30+
 31+
 32+ }
3333
34 - public function write($message, $mode = false)
35 - {
36 - $out .= '';
37 - if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '<font color="green">';
38 - $out .= htmlentities($message);
39 - if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '</font>';
40 - if ($mode != MW_TESTLOGGER_CONTINUE_LINE) $out .= '<br/>';
 34+ public function write($message, $mode = false)
 35+ {
 36+ $out .= '';
 37+ if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '<font color="green">';
 38+ $out .= htmlentities($message);
 39+ if ($mode == MW_TESTLOGGER_RESULT_OK) $out .= '</font>';
 40+ if ($mode != MW_TESTLOGGER_CONTINUE_LINE) $out .= '<br/>';
4141
42 - echo $out;
43 - }
 42+ echo $out;
 43+ }
4444 }
\ No newline at end of file
Index: trunk/phase3/maintenance/tests/selenium/SeleniumTestListener.php
@@ -6,69 +6,69 @@
77
88 class SeleniumTestListener implements PHPUnit_Framework_TestListener
99 {
10 - private $logger;
11 - private $tests_ok = 0;
12 - private $tests_failed = 0;
 10+ private $logger;
 11+ private $tests_ok = 0;
 12+ private $tests_failed = 0;
1313
14 - public function __construct($loggerInstance)
15 - {
16 - $this->logger = $loggerInstance;
17 - }
 14+ public function __construct($loggerInstance)
 15+ {
 16+ $this->logger = $loggerInstance;
 17+ }
1818
19 - public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
20 - {
21 - $this->logger->write("Error: ".$e->getMessage());
22 - $this->tests_failed++;
23 - }
 19+ public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
 20+ {
 21+ $this->logger->write("Error: ".$e->getMessage());
 22+ $this->tests_failed++;
 23+ }
2424
25 - public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
26 - {
27 - $this->logger->write("Failed: ".$e->getMessage());
28 - $this->tests_failed++;
 25+ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 26+ {
 27+ $this->logger->write("Failed: ".$e->getMessage());
 28+ $this->tests_failed++;
2929
30 - }
 30+ }
3131
32 - public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
33 - {
34 - $this->logger->write("Incomplete.");
35 - $this->tests_failed++;
36 - }
 32+ public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
 33+ {
 34+ $this->logger->write("Incomplete.");
 35+ $this->tests_failed++;
 36+ }
3737
38 - public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
39 - {
40 - $this->logger->write("Skipped.");
41 - $this->tests_failed++;
42 - }
 38+ public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
 39+ {
 40+ $this->logger->write("Skipped.");
 41+ $this->tests_failed++;
 42+ }
4343
44 - public function startTest(PHPUnit_Framework_Test $test)
45 - {
46 - $this->logger->write("Testing ".$test->getName()." ... ", MW_TESTLOGGER_CONTINUE_LINE);
47 - }
 44+ public function startTest(PHPUnit_Framework_Test $test)
 45+ {
 46+ $this->logger->write("Testing ".$test->getName()." ... ", MW_TESTLOGGER_CONTINUE_LINE);
 47+ }
4848
49 - public function endTest(PHPUnit_Framework_Test $test, $time)
50 - {
51 - if (!$test->hasFailed())
52 - {
53 - $this->logger->write("OK", MW_TESTLOGGER_RESULT_OK);
54 - $this->tests_ok++;
55 - }
56 - }
 49+ public function endTest(PHPUnit_Framework_Test $test, $time)
 50+ {
 51+ if (!$test->hasFailed())
 52+ {
 53+ $this->logger->write("OK", MW_TESTLOGGER_RESULT_OK);
 54+ $this->tests_ok++;
 55+ }
 56+ }
5757
58 - public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
59 - {
60 - $this->logger->write("Testsuite ".$suite->getName()." started.");
61 - $this->tests_ok = 0;
62 - }
 58+ public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
 59+ {
 60+ $this->logger->write("Testsuite ".$suite->getName()." started.");
 61+ $this->tests_ok = 0;
 62+ }
6363
64 - public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
65 - {
66 - $this->logger->write("Testsuite ".$suite->getName()." ended. OK: ".$this->tests_ok." Failed: ".$this->tests_failed);
 64+ public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
 65+ {
 66+ $this->logger->write("Testsuite ".$suite->getName()." ended. OK: ".$this->tests_ok." Failed: ".$this->tests_failed);
6767
68 - }
 68+ }
6969
70 - public function statusMessage($message)
71 - {
72 - $this->logger->write($message);
73 - }
 70+ public function statusMessage($message)
 71+ {
 72+ $this->logger->write($message);
 73+ }
7474 }
7575

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r65715Initial commit of the Selenium frameworklaner20:45, 30 April 2010

Status & tagging log