6aadbfaa2d9b80638f3304ed605dfba3bb7b8c35
[lhc/web/wiklou.git] / maintenance / tests / selenium / SeleniumTestCase.php
1 <?php
2 if (!defined('MEDIAWIKI') || !defined('SELENIUMTEST')) {
3 echo "This script cannot be run standalone";
4 exit(1);
5 }
6
7 class SeleniumTestCase extends PHPUnit_Framework_TestCase //PHPUnit_Extensions_SeleniumTestCase
8 {
9 protected $selenium;
10
11 public function setUp()
12 {
13 set_time_limit(60);
14 $this->selenium = Selenium::getInstance();
15 //print_r($this->suite);
16 }
17
18 public function tearDown()
19 {
20
21 }
22
23 public function __call($method, $args)
24 {
25 return call_user_func_array (array($this->selenium, $method), $args);
26 }
27
28 public function assertSeleniumAttributeEquals($attribute, $value)
29 {
30 $attr = $this->getAttribute($attribute);
31 $this->assertEquals($attr, $value);
32 }
33
34 public function assertSeleniumHTMLContains($element, $text)
35 {
36 $innerHTML = $this->getText($element);
37 //or assertContains
38 $this->assertRegExp("/$text/", $innerHTML );
39 }
40
41 }
42
43 ?>