| Total Complexity | 4 |
| Total Lines | 66 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | trait ActionAssertions |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Asserts that this component has the specified field. |
||
| 14 | * |
||
| 15 | * @param string $action The class path of the Action |
||
| 16 | * @param string $message |
||
| 17 | * @return $this |
||
| 18 | */ |
||
| 19 | 2 | public function assertHasAction(string $action, string $message = ''): self |
|
| 20 | { |
||
| 21 | 2 | PHPUnit::assertThat( |
|
| 22 | 2 | $this->component->actions(Request::createFromGlobals()), |
|
| 23 | 2 | new ArrayHasInstanceOf($action), |
|
| 24 | 2 | $message |
|
| 25 | ); |
||
| 26 | |||
| 27 | 1 | return $this; |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Asserts that this component does not have the specified field. |
||
| 32 | * |
||
| 33 | * @param string $action The class path of the Action |
||
| 34 | * @param string $message |
||
| 35 | * @return $this |
||
| 36 | */ |
||
| 37 | 2 | public function assertActionMissing(string $action, string $message = ''): self |
|
| 38 | { |
||
| 39 | 2 | PHPUnit::assertThat( |
|
| 40 | 2 | $this->component->actions(Request::createFromGlobals()), |
|
| 41 | 2 | PHPUnit::logicalNot(new ArrayHasInstanceOf($action)), |
|
| 42 | 2 | $message |
|
| 43 | ); |
||
| 44 | |||
| 45 | 1 | return $this; |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Asserts that this component has no Actions specified. |
||
| 50 | * |
||
| 51 | * @param string $message |
||
| 52 | * @return $this |
||
| 53 | */ |
||
| 54 | 2 | public function assertHasNoActions(string $message = ''): self |
|
| 55 | { |
||
| 56 | 2 | PHPUnit::assertCount(0, $this->component->fields(Request::createFromGlobals()), $message); |
|
| 57 | |||
| 58 | 1 | return $this; |
|
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Asserts that all actions on this component are valid Actions. |
||
| 63 | * |
||
| 64 | * @param string $message |
||
| 65 | * @return $this |
||
| 66 | */ |
||
| 67 | 3 | public function assertHasValidActions(string $message = ''): self |
|
| 76 | } |
||
| 77 | } |
||
| 78 |