New test database resource file with some test configuration changes for it. Follow...
[lhc/web/wiklou.git] / tests / selenium / SeleniumTestSuite.php
1 <?php
2
3 abstract class SeleniumTestSuite extends PHPUnit_Framework_TestSuite {
4 private $selenium;
5 private $isSetUp = false;
6 private $loginBeforeTests = true;
7
8 // Do not add line break after test output
9 const CONTINUE_LINE = 1;
10 const RESULT_OK = 2;
11 const RESULT_ERROR = 3;
12
13 public abstract function addTests();
14
15 public function setUp() {
16 // Hack because because PHPUnit version 3.0.6 which is on prototype does not
17 // run setUp as part of TestSuite::run
18 if ( $this->isSetUp ) {
19 return;
20 }
21 $this->isSetUp = true;
22 $this->selenium = Selenium::getInstance();
23 $this->selenium->start();
24 $this->selenium->open( $this->selenium->getUrl() . '/index.php?setupTestSuite=' . $this->getName() );
25 //wait a little longer for the db operation
26 $this->selenium->waitForPageToLoad( 6000 );
27 if ( $this->loginBeforeTests ) {
28 $this->login();
29 }
30 }
31
32 public function tearDown() {
33 $this->selenium->open( $this->selenium->getUrl() . '/index.php?clearTestSuite=' . $this->getName() );
34 $this->selenium->stop();
35 }
36
37 public function login() {
38 $this->selenium->login();
39 }
40
41 public function loadPage( $title, $action ) {
42 $this->selenium->loadPage( $title, $action );
43 }
44
45 protected function setLoginBeforeTests( $loginBeforeTests = true ) {
46 $this->loginBeforeTests = $loginBeforeTests;
47 }
48 }