assertSame(++$i, $value); }); Amp\wait($stream); $this->assertSame($count, $i); } /** * @depends testInterval */ public function testSlowConsumer() { $invoked = 0; $count = 5; Loop::execute(function () use (&$invoked, $count) { $stream = Amp\interval(self::TIMEOUT, $count); $stream->listen(function () use (&$invoked) { ++$invoked; return new Pause(self::TIMEOUT * 2); }); }); $this->assertSame($count, $invoked); } /** * @expectedException \Error * @expectedExceptionMessage The number of times to emit must be a positive value */ public function testInvalidCount() { $stream = Amp\interval(self::TIMEOUT, -1); } }