giorgiosironi / phpunit-selenium

Selenium RC integration for PHPUnit
http://www.phpunit.de/
Other
600 stars 271 forks source link

Failing test ran in an isolated process complains about closures that can not be serialized #325

Open cyberwolf opened 10 years ago

cyberwolf commented 10 years ago

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',
        );
    }
giorgiosironi commented 10 years ago

Seems backward compatible, I will cherry-pick the commit inside the master branch.