Beispiel #1
0
 public function testLimitsRate()
 {
     $stub = $this->getMockBuilder('FakeObj')->setMethods(['foo'])->getMock();
     $stub->method('foo')->willReturn('bar');
     $r = new SimpleRateLimiter($stub, ['limits' => [10 => 1]]);
     $this->assertEquals('bar', $r->foo());
     $this->expectException(OverRateLimitException::class);
     $this->assertEquals('bar', $r->foo());
 }