Total Complexity | 4 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | final class ThrottleBuilderTest extends TestCase |
||
14 | { |
||
15 | /** |
||
16 | * @test |
||
17 | */ |
||
18 | public function multiple_resources_are_converted_to_string(): void |
||
19 | { |
||
20 | $key = ThrottleFactory::for('memory') |
||
21 | ->throttle('a', 'b') |
||
22 | ->with('c', 'd') |
||
23 | ->with('e') |
||
24 | ->allow(5) |
||
25 | ->every(60) |
||
26 | ->hit() |
||
27 | ->key() |
||
28 | ; |
||
29 | |||
30 | $this->assertSame('abcde', $key->resource()); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @test |
||
35 | */ |
||
36 | public function limit_is_required(): void |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @test |
||
46 | */ |
||
47 | public function ttl_is_required(): void |
||
48 | { |
||
49 | $this->expectException(\LogicException::class); |
||
50 | $this->expectExceptionMessage(\sprintf('You must set a "TTL" for the throttle via "%s::every($ttl)"', ThrottleBuilder::class)); |
||
51 | |||
52 | (new ThrottleBuilder(new ThrottleFactory(new MemoryStore()), 'foo'))->allow(10)->create(); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @test |
||
57 | */ |
||
58 | public function resource_is_required(): void |
||
64 | } |
||
65 | } |
||
66 |