I have created a set of testcases created using phpunit and selenium that I execute on a website. But now, there is a 2nd website for which I must execute the same tests. The only difference is the url to access the website.
I have tried using a SESSION variable that is set to different value each time phpunit runs. In the each test case I would reference this SESSION var but it is not working for me. How do I deal with this? I don't want to have 2 versions of identical testcases.
What I tried:
session_start();
$environments = array('www.test1.com', 'www.test2.com');
$arrlength = count($environments);
for($x = 0; $x < $arrlength; $x++) {
$_SESSION['TEST_ENVIRONMENT'] = $environments[$x]; // Set session variable = environment
phpunit -c phpunit.xml // xml file containing the testcases
unset($_SESSION['TEST_ENVIRONMENT']); //Unset only TEST_ENVIRONMENT index in session variable
}