public function testConsume($expected, $tokens, Rate $rate) { $bucket = new TokenBucket(10000, $rate, new SingleProcessStorage()); $consumer = new BlockingConsumer($bucket); $bucket->bootstrap(); $time = microtime(true); $consumer->consume($tokens); $this->assertEquals($expected, microtime(true) - $time); }