1 | <?php |
||
5 | class ApiHealthFake |
||
6 | { |
||
7 | /** |
||
8 | * An array of checkers where the value is the desired status. |
||
9 | * |
||
10 | * @var array |
||
11 | */ |
||
12 | private $fakedStates = []; |
||
13 | |||
14 | /** |
||
15 | * Marks the given checker as failing. |
||
16 | * |
||
17 | * @param string $checkerClass |
||
18 | * @return $this |
||
19 | */ |
||
20 | public function mustFail(string $checkerClass) |
||
26 | |||
27 | /** |
||
28 | * Marks the given checker as passing. |
||
29 | * |
||
30 | * @param string $checkerClass |
||
31 | * @return $this |
||
32 | */ |
||
33 | public function mustPass(string $checkerClass) |
||
39 | |||
40 | /** |
||
41 | * Returns this instance. |
||
42 | * |
||
43 | * @return $this |
||
44 | */ |
||
45 | public function fresh() |
||
49 | |||
50 | /** |
||
51 | * Returns if the stored state is set to failed or runs the checker |
||
52 | * if nothing is stored and returns wether the checker fails. |
||
53 | * |
||
54 | * @param string $checkerClass |
||
55 | * @return bool |
||
56 | */ |
||
57 | public function isFailing(string $checkerClass): bool |
||
61 | |||
62 | /** |
||
63 | * The opposite of the 'isFailing' method. |
||
64 | * |
||
65 | * @param string $checkerClass |
||
66 | * @return bool |
||
67 | */ |
||
68 | public function isPassing(string $checkerClass): bool |
||
72 | } |
||
73 |