If I run a test using phpunit-selenium in process isolation, if it fails to find certain elements using the selenium API, it ends up not showing the expected exception but instead something like this:
PHPUnit_Framework_Exception: Exception: Serialization of "Closure" is not allowed in serialize() (line 72 of -)
I was able to trace back the problem to PHPUnit_Extensions_Selenium2TestCase_CommandsHolder, which puts a series of anonymous functions in its $commands member instance. Have been able to work around the problem by adding a __sleep() implementation in that same class, so it does not try to serialize $commands any longer:
public function __sleep() {
return array(
'url',
'driver',
);
}
If I run a test using phpunit-selenium in process isolation, if it fails to find certain elements using the selenium API, it ends up not showing the expected exception but instead something like this:
I was able to trace back the problem to PHPUnit_Extensions_Selenium2TestCase_CommandsHolder, which puts a series of anonymous functions in its $commands member instance. Have been able to work around the problem by adding a __sleep() implementation in that same class, so it does not try to serialize $commands any longer: