1
0
mirror of https://github.com/danog/amp.git synced 2024-11-26 20:15:00 +01:00

Add test for Producer being already resolved

This commit is contained in:
Niklas Keller 2017-03-14 22:05:19 +01:00
parent 6b9ec609c1
commit 4442f6cd33

View File

@ -181,4 +181,22 @@ class ProducerTest extends TestCase {
$this->assertSame($exception, $caught);
}
}
public function testListenAfterResolve() {
$invoked = false;
Loop::run(function () use (&$invoked) {
$producer = new Producer(function (callable $emit) use (&$invoked) {
yield $emit(1);
});
yield $producer;
$producer->listen(function () use (&$invoked) {
$invoked = true;
});
});
$this->assertFalse($invoked);
}
}