Skip to content

Commit

Permalink
Merge pull request #55 from clue-labs/phpunit
Browse files Browse the repository at this point in the history
Fix test suite race condition by catching namespaced Exception variant
  • Loading branch information
WyriHaximus authored Dec 21, 2017
2 parents 266770c + 7e76177 commit 45cbd17
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/AbstractProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use React\ChildProcess\Process;
use React\EventLoop\Timer\Timer;
use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\TestCase;
use SebastianBergmann\Environment\Runtime;

Expand Down Expand Up @@ -468,7 +469,11 @@ public function assertSoon(\Closure $callback, $timeout = 20000, $interval = 200
try {
call_user_func($callback);
return;
} catch (\PHPUnit_Framework_ExpectationFailedException $e) {}
} catch (ExpectationFailedException $e) {
// namespaced PHPUnit exception
} catch (\PHPUnit_Framework_ExpectationFailedException $e) {
// legacy PHPUnit exception
}

if ((microtime(true) - $start) > $timeout) {
throw $e;
Expand Down

0 comments on commit 45cbd17

Please sign in to comment.