-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
59 lines (51 loc) · 1.35 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
// Make sure all code is taken only from local dir (exclude PEAR install of PHPUnit)
ini_set('inclide_path', __DIR__);
require 'vendor/autoload.php';
class TestCase extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
$this->setBrowser('firefox');
//$this->setBrowser('chrome');
// Get URL from env, will not be overwritten by phpunit.xml
$url = getenv('SELENIUM_BROWSER_URL');
// Set URL from phpunit.xml
if (empty($url)) {
$url = $GLOBALS['url'];
}
$this->setBrowserUrl($url);
}
/**
* (non-PHPdoc)
* @see PHPUnit_Extensions_Selenium2TestCase::prepareSession()
*/
public function prepareSession()
{
try {
$this->session = parent::prepareSession();
} catch (PHPUnit_Framework_SkippedTestError $ex){
// Fail the test if it was skipped (most likely a system error).
$this->fail($ex->getMessage());
}
return $this->session;
}
/**
* (non-PHPdoc)
* @see PHPUnit_Extensions_Selenium2TestCase::setBrowserUrl()
*/
public function setBrowserUrl($browserUrl)
{
// Make sure $browserUrl does not end with /
$browserUrl = rtrim($browserUrl, '/');
parent::setBrowserUrl($browserUrl);
}
/**
* Open relative URL
*/
public function open($url)
{
$url = $this->getBrowserUrl() . $url;
return $this->url($url);
}
}