3 abstract class SeleniumTestSuite
extends PHPUnit_Framework_TestSuite
{
5 private $isSetUp = false;
6 private $loginBeforeTests = true;
8 // Do not add line break after test output
9 const CONTINUE_LINE
= 1;
11 const RESULT_ERROR
= 3;
13 public abstract function addTests();
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
) {
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
) {
32 public function tearDown() {
33 $this->selenium
->open( $this->selenium
->getUrl() . '/index.php?clearTestSuite=' . $this->getName() );
34 $this->selenium
->stop();
37 public function login() {
38 $this->selenium
->login();
41 public function loadPage( $title, $action ) {
42 $this->selenium
->loadPage( $title, $action );
45 protected function setLoginBeforeTests( $loginBeforeTests = true ) {
46 $this->loginBeforeTests
= $loginBeforeTests;