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:
parent
6b9ec609c1
commit
4442f6cd33
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user