Skip to content

Instantly share code, notes, and snippets.

@glennpratt
Created August 18, 2011 18:14
Show Gist options
  • Save glennpratt/1154724 to your computer and use it in GitHub Desktop.
Save glennpratt/1154724 to your computer and use it in GitHub Desktop.
Run PHPUnit Selenium test methods with out closing the session, except between classes.
<?php
class SeleniumTestHelper extends PHPUnit_Extensions_SeleniumTestCase {
protected $sharedSession = FALSE;
/**
* @throws RuntimeException
*/
protected function runTest()
{
if (!is_file($this->getName(FALSE))) {
if (!$this->sharedSession) {
$this->sharedSession = TRUE;
$this->start();
}
PHPUnit_Framework_TestCase::runTest();
} else {
parent::runTest();
}
}
function __destruct() {
if ($this->sharedSession) {
$this->stop();
}
//parent::__destruct();
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment