|
|
|
|
@ -40,8 +40,6 @@ class CapabilitiesTest extends TestCase { |
|
|
|
|
parent::setUp(); |
|
|
|
|
|
|
|
|
|
$this->request = $this->createMock(IRequest::class); |
|
|
|
|
$this->request->method('getRemoteAddress') |
|
|
|
|
->willReturn('10.10.10.10'); |
|
|
|
|
|
|
|
|
|
$this->throttler = $this->createMock(Throttler::class); |
|
|
|
|
|
|
|
|
|
@ -57,6 +55,9 @@ class CapabilitiesTest extends TestCase { |
|
|
|
|
->with('10.10.10.10') |
|
|
|
|
->willReturn(42); |
|
|
|
|
|
|
|
|
|
$this->request->method('getRemoteAddress') |
|
|
|
|
->willReturn('10.10.10.10'); |
|
|
|
|
|
|
|
|
|
$expected = [ |
|
|
|
|
'bruteforce' => [ |
|
|
|
|
'delay' => 42 |
|
|
|
|
@ -66,4 +67,23 @@ class CapabilitiesTest extends TestCase { |
|
|
|
|
|
|
|
|
|
$this->assertEquals($expected, $result); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testGetCapabilitiesOnCli() { |
|
|
|
|
$this->throttler->expects($this->atLeastOnce()) |
|
|
|
|
->method('getDelay') |
|
|
|
|
->with('') |
|
|
|
|
->willReturn(0); |
|
|
|
|
|
|
|
|
|
$this->request->method('getRemoteAddress') |
|
|
|
|
->willReturn(''); |
|
|
|
|
|
|
|
|
|
$expected = [ |
|
|
|
|
'bruteforce' => [ |
|
|
|
|
'delay' => 0 |
|
|
|
|
] |
|
|
|
|
]; |
|
|
|
|
$result = $this->capabilities->getCapabilities(); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($expected, $result); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|