Total Complexity | 4 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | trait FieldAssertions |
||
11 | { |
||
12 | /** |
||
13 | * Checks that this Nova component has a field with the same name or attribute. |
||
14 | * |
||
15 | * @param string $field The name or attribute of the field |
||
16 | * @param string $message |
||
17 | * @return $this |
||
18 | */ |
||
19 | 4 | public function assertHasField(string $field, string $message = ''): self |
|
20 | { |
||
21 | 4 | PHPUnit::assertThat( |
|
22 | 4 | $this->component->fields(Request::createFromGlobals()), |
|
23 | 4 | new HasField($field), |
|
24 | 4 | $message |
|
25 | ); |
||
26 | |||
27 | 2 | return $this; |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * Checks that no field on this Nova component has a name or attribute matching |
||
32 | * the given parameter. |
||
33 | * |
||
34 | * @param string $field |
||
35 | * @param string $message |
||
36 | * @return $this |
||
37 | */ |
||
38 | 4 | public function assertFieldMissing(string $field, string $message = ''): self |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * Asserts that this Nova Action has no fields defined. |
||
51 | * @param string $message |
||
52 | * @return $this |
||
53 | */ |
||
54 | 2 | public function assertHasNoFields(string $message = ''): self |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * Asserts that all fields defined on this Nova Action are valid fields. |
||
63 | * |
||
64 | * @param string $message |
||
65 | * @return $this |
||
66 | */ |
||
67 | 3 | public function assertHasValidFields(string $message = ''): self |
|
76 | } |
||
77 | } |
||
78 |