Add @covers annotations to IP tests
[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 if ( $this->loginBeforeTests ) {
26 $this->login();
27 }
28 }
29
30 public function tearDown() {
31 $this->selenium->open( $this->selenium->getUrl() . '/index.php?clearTestSuite=' . $this->getName() );
32 $this->selenium->stop();
33 }
34
35 public function login() {
36 $this->selenium->login();
37 }
38
39 public function loadPage( $title, $action ) {
40 $this->selenium->loadPage( $title, $action );
41 }
42
43 protected function setLoginBeforeTests( $loginBeforeTests = true ) {
44 $this->loginBeforeTests = $loginBeforeTests;
45 }
46 }