summaryrefslogtreecommitdiff
path: root/maintenance/tests/selenium/SeleniumTestSuite.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /maintenance/tests/selenium/SeleniumTestSuite.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'maintenance/tests/selenium/SeleniumTestSuite.php')
-rw-r--r--maintenance/tests/selenium/SeleniumTestSuite.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/maintenance/tests/selenium/SeleniumTestSuite.php b/maintenance/tests/selenium/SeleniumTestSuite.php
new file mode 100644
index 00000000..ba178051
--- /dev/null
+++ b/maintenance/tests/selenium/SeleniumTestSuite.php
@@ -0,0 +1,46 @@
+<?php
+
+abstract class SeleniumTestSuite extends PHPUnit_Framework_TestSuite {
+ private $selenium;
+ private $isSetUp = false;
+ private $loginBeforeTests = true;
+
+ // Do not add line break after test output
+ const CONTINUE_LINE = 1;
+ const RESULT_OK = 2;
+ const RESULT_ERROR = 3;
+
+ public abstract function addTests();
+
+ public function setUp() {
+ // Hack because because PHPUnit version 3.0.6 which is on prototype does not
+ // run setUp as part of TestSuite::run
+ if ( $this->isSetUp ) {
+ return;
+ }
+ $this->isSetUp = true;
+ $this->selenium = Selenium::getInstance();
+ $this->selenium->start();
+ $this->selenium->open( $this->selenium->getUrl() . '/index.php?setupTestSuite=' . $this->getName() );
+ if ( $this->loginBeforeTests ) {
+ $this->login();
+ }
+ }
+
+ public function tearDown() {
+ $this->selenium->open( $this->selenium->getUrl() . '/index.php?clearTestSuite=' . $this->getName() );
+ $this->selenium->stop();
+ }
+
+ public function login() {
+ $this->selenium->login();
+ }
+
+ public function loadPage( $title, $action ) {
+ $this->selenium->loadPage( $title, $action );
+ }
+
+ protected function setLoginBeforeTests( $loginBeforeTests = true ) {
+ $this->loginBeforeTests = $loginBeforeTests;
+ }
+}