1
0
mirror of https://github.com/danog/amp.git synced 2025-01-22 13:21:16 +01:00

Re-enable generator test and fix it

This commit is contained in:
Niklas Keller 2017-03-15 07:32:43 +01:00
parent 5b52b94fe0
commit d61709db45

View File

@ -8,6 +8,7 @@ use Amp\Loop;
use Amp\Loop\Driver;
use Amp\Loop\InvalidWatcherError;
use Amp\Loop\UnsupportedFeatureException;
use Amp\Success;
use PHPUnit\Framework\TestCase;
use React\Promise\RejectedPromise as RejectedReactPromise;
@ -1285,30 +1286,29 @@ abstract class DriverTest extends TestCase {
}
function testRethrowsFromCallbacks() {
$promises = [
new Failure(new \Exception("rethrow test")),
new RejectedReactPromise(new \Exception("rethrow test")),
new Coroutine((function () {
if (false) {
yield;
}
foreach (["onReadable", "onWritable", "defer", "delay", "repeat", "onSignal"] as $watcher) {
$promises = [
new Failure(new \Exception("rethrow test")),
new RejectedReactPromise(new \Exception("rethrow test")),
new Coroutine((function () {
if (false) {
yield;
}
throw new \Exception("rethrow test");
})()),
/* FIXME: Re-enable test. (function () {
if (false) {
yield;
}
throw new \Exception("rethrow test");
})()),
(function () {
if (false) {
yield;
}
throw new \Exception("rethrow test");
})(), */
null,
];
throw new \Exception("rethrow test");
})(),
null,
];
$data = [];
foreach ($promises as $promise) {
foreach ($promises as $promise) {
foreach (["onReadable", "onWritable", "defer", "delay", "repeat", "onSignal"] as $watcher) {
if ($watcher === "onSignal") {
$this->checkForSignalCapability();
}
@ -1363,6 +1363,7 @@ abstract class DriverTest extends TestCase {
$this->fail("Didn't throw expected exception.");
} catch (\Exception $e) {
var_dump((string) $e);
$this->assertSame("rethrow test", $e->getMessage());
}
}