|
@@ 77-83 (lines=7) @@
|
| 74 |
|
$throttle->putDelay('test', '192.168.1.1');
|
| 75 |
|
}
|
| 76 |
|
|
| 77 |
|
public function testCalculateDelayForUid() {
|
| 78 |
|
$this->dbServiceMock->expects($this->once())->method('getSuspiciousActivityCountForUid')
|
| 79 |
|
->with('test')
|
| 80 |
|
->willReturn(2);
|
| 81 |
|
|
| 82 |
|
$this->assertEquals(2, $this->throttle->calculateDelayForUid('test'));
|
| 83 |
|
}
|
| 84 |
|
|
| 85 |
|
public function testCalculateDelayForIp() {
|
| 86 |
|
$this->dbServiceMock->expects($this->once())->method('getSuspiciousActivityCountForIp')
|
|
@@ 85-91 (lines=7) @@
|
| 82 |
|
$this->assertEquals(2, $this->throttle->calculateDelayForUid('test'));
|
| 83 |
|
}
|
| 84 |
|
|
| 85 |
|
public function testCalculateDelayForIp() {
|
| 86 |
|
$this->dbServiceMock->expects($this->once())->method('getSuspiciousActivityCountForIp')
|
| 87 |
|
->with('192.168.1.1')
|
| 88 |
|
->willReturn(5);
|
| 89 |
|
|
| 90 |
|
$this->assertEquals(5, $this->throttle->calculateDelayForIp('192.168.1.1'));
|
| 91 |
|
}
|
| 92 |
|
|
| 93 |
|
public function testClearSuspiciousAttemptsForIp() {
|
| 94 |
|
$this->dbServiceMock->expects($this->once())->method('deleteSuspiciousAttemptsForIp')
|