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 |
|
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 |
|
39 | { |
||
40 | 4 | PHPUnit::assertThat( |
|
41 | 4 | $this->component->fields(Request::createFromGlobals()), |
|
42 | 4 | PHPUnit::logicalNot(new HasField($field)), |
|
43 | 4 | $message |
|
44 | ); |
||
45 | |||
46 | 2 | return $this; |
|
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 |
|
55 | { |
||
56 | 2 | PHPUnit::assertCount(0, $this->component->fields(Request::createFromGlobals()), $message); |
|
57 | |||
58 | 1 | return $this; |
|
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 |