Created
October 9, 2012 20:57
-
-
Save heddn/3861376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class BaseTest extends PHPUnit_Extensions_SeleniumTestCase { | |
protected $autoStop = FALSE; | |
protected function setUp() { | |
$this->setBrowserUrl('http://www.example.com'); | |
} | |
/** | |
* common commands required at the start of each test. These cannot be run in the setup | |
* as they require the browser to be opened | |
*/ | |
protected function init() { | |
$this->clearAllCookies(); | |
$this->openHomePage(); | |
} | |
/** | |
* Clears all cookies | |
*/ | |
private function clearAllCookies() { | |
$cookies = explode(';', $this->getCookie()); | |
foreach ($cookies as $cookie) { | |
$cookie_parts = explode('=', $cookie); | |
$this->deleteCookie($cookie_parts[0], '/'); | |
} | |
} | |
/** | |
* Open the homepage and verifies we are in fact on the home page | |
*/ | |
private function openHomePage() { | |
$this->open("/"); | |
$this->waitForPageToLoad("30000"); | |
$this->assertEquals("Home", $this->getText("xpath=//h1[@id='page-title']")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment