@@ -22,14 +22,17 @@ trait MarkupAssertionsTrait
22
22
*
23
23
* @since 1.0.0
24
24
*
25
- * @param string $selector A query selector for the element to find .
26
- * @param string $markup The output that should contain the $selector.
27
- * @param string $message A message to display if the assertion fails.
25
+ * @param string|array<string, scalar> $selector A query selector to search for .
26
+ * @param string $markup The output that should contain the $selector.
27
+ * @param string $message A message to display if the assertion fails.
28
28
*
29
29
* @return void
30
30
*/
31
- public function assertContainsSelector ($ selector , $ markup = '' , $ message = '' )
32
- {
31
+ public function assertContainsSelector (
32
+ $ selector ,
33
+ string $ markup = '' ,
34
+ string $ message = ''
35
+ ) {
33
36
$ constraint = new ContainsSelector (new Selector ($ selector ));
34
37
35
38
static ::assertThat ($ markup , $ constraint , $ message );
@@ -40,14 +43,17 @@ public function assertContainsSelector($selector, $markup = '', $message = '')
40
43
*
41
44
* @since 1.0.0
42
45
*
43
- * @param string $selector A query selector for the element to find .
44
- * @param string $markup The output that should not contain the $selector.
45
- * @param string $message A message to display if the assertion fails.
46
+ * @param string|array<string, scalar> $selector A query selector to search for .
47
+ * @param string $markup The output that should not contain the $selector.
48
+ * @param string $message A message to display if the assertion fails.
46
49
*
47
50
* @return void
48
51
*/
49
- public function assertNotContainsSelector ($ selector , $ markup = '' , $ message = '' )
50
- {
52
+ public function assertNotContainsSelector (
53
+ $ selector ,
54
+ string $ markup = '' ,
55
+ string $ message = ''
56
+ ) {
51
57
$ constraint = new LogicalNot (new ContainsSelector (new Selector ($ selector )));
52
58
53
59
static ::assertThat ($ markup , $ constraint , $ message );
@@ -58,15 +64,19 @@ public function assertNotContainsSelector($selector, $markup = '', $message = ''
58
64
*
59
65
* @since 1.0.0
60
66
*
61
- * @param int $count The number of matching elements expected.
62
- * @param string $selector A query selector for the element to find .
63
- * @param string $markup The markup to run the assertion against.
64
- * @param string $message A message to display if the assertion fails.
67
+ * @param int $count The number of matching elements expected.
68
+ * @param string|array<string, scalar> $selector A query selector to search for .
69
+ * @param string $markup The markup to run the assertion against.
70
+ * @param string $message A message to display if the assertion fails.
65
71
*
66
72
* @return void
67
73
*/
68
- public function assertSelectorCount ($ count , $ selector , $ markup = '' , $ message = '' )
69
- {
74
+ public function assertSelectorCount (
75
+ int $ count ,
76
+ $ selector ,
77
+ string $ markup = '' ,
78
+ string $ message = ''
79
+ ) {
70
80
$ constraint = new SelectorCount (new Selector ($ selector ), $ count );
71
81
72
82
static ::assertThat ($ markup , $ constraint , $ message );
@@ -85,8 +95,11 @@ public function assertSelectorCount($count, $selector, $markup = '', $message =
85
95
*
86
96
* @return void
87
97
*/
88
- public function assertHasElementWithAttributes ($ attributes = [], $ markup = '' , $ message = '' )
89
- {
98
+ public function assertHasElementWithAttributes (
99
+ array $ attributes = [],
100
+ string $ markup = '' ,
101
+ string $ message = ''
102
+ ) {
90
103
$ constraint = new ContainsSelector (new Selector ($ attributes ));
91
104
92
105
static ::assertThat ($ markup , $ constraint , $ message );
@@ -105,8 +118,11 @@ public function assertHasElementWithAttributes($attributes = [], $markup = '', $
105
118
*
106
119
* @return void
107
120
*/
108
- public function assertNotHasElementWithAttributes ($ attributes = [], $ markup = '' , $ message = '' )
109
- {
121
+ public function assertNotHasElementWithAttributes (
122
+ $ attributes = [],
123
+ $ markup = '' ,
124
+ $ message = ''
125
+ ) {
110
126
$ constraint = new LogicalNot (new ContainsSelector (new Selector ($ attributes )));
111
127
112
128
static ::assertThat ($ markup , $ constraint , $ message );
@@ -117,15 +133,19 @@ public function assertNotHasElementWithAttributes($attributes = [], $markup = ''
117
133
*
118
134
* @since 1.1.0
119
135
*
120
- * @param string $contents The string to look for within the DOM node's contents.
121
- * @param string $selector A query selector for the element to find .
122
- * @param string $markup The output that should contain the $selector.
123
- * @param string $message A message to display if the assertion fails.
136
+ * @param string $contents The string to look for within the DOM node's contents.
137
+ * @param string|array<string, scalar> $selector A query selector to search for .
138
+ * @param string $markup The output that should contain the $selector.
139
+ * @param string $message A message to display if the assertion fails.
124
140
*
125
141
* @return void
126
142
*/
127
- public function assertElementContains ($ contents , $ selector = '' , $ markup = '' , $ message = '' )
128
- {
143
+ public function assertElementContains (
144
+ string $ contents ,
145
+ $ selector = '' ,
146
+ string $ markup = '' ,
147
+ string $ message = ''
148
+ ) {
129
149
$ constraint = new ElementContainsString (new Selector ($ selector ), $ contents );
130
150
131
151
static ::assertThat ($ markup , $ constraint , $ message );
@@ -136,15 +156,19 @@ public function assertElementContains($contents, $selector = '', $markup = '', $
136
156
*
137
157
* @since 1.1.0
138
158
*
139
- * @param string $contents The string to look for within the DOM node's contents.
140
- * @param string $selector A query selector for the element to find .
141
- * @param string $markup The output that should not contain the $selector.
142
- * @param string $message A message to display if the assertion fails.
159
+ * @param string $contents The string to look for within the DOM node's contents.
160
+ * @param string|array<string, scalar> $selector A query selector to search for .
161
+ * @param string $markup The output that should not contain the $selector.
162
+ * @param string $message A message to display if the assertion fails.
143
163
*
144
164
* @return void
145
165
*/
146
- public function assertElementNotContains ($ contents , $ selector = '' , $ markup = '' , $ message = '' )
147
- {
166
+ public function assertElementNotContains (
167
+ string $ contents ,
168
+ $ selector = '' ,
169
+ string $ markup = '' ,
170
+ string $ message = ''
171
+ ) {
148
172
$ constraint = new LogicalNot (new ElementContainsString (new Selector ($ selector ), $ contents ));
149
173
150
174
static ::assertThat ($ markup , $ constraint , $ message );
@@ -155,15 +179,19 @@ public function assertElementNotContains($contents, $selector = '', $markup = ''
155
179
*
156
180
* @since 1.1.0
157
181
*
158
- * @param string $regexp The regular expression pattern to look for within the DOM node.
159
- * @param string $selector A query selector for the element to find .
160
- * @param string $markup The output that should contain the $selector.
161
- * @param string $message A message to display if the assertion fails.
182
+ * @param string $regexp The regular expression pattern to look for within the DOM node.
183
+ * @param string|array<string, scalar> $selector A query selector to search for .
184
+ * @param string $markup The output that should contain the $selector.
185
+ * @param string $message A message to display if the assertion fails.
162
186
*
163
187
* @return void
164
188
*/
165
- public function assertElementRegExp ($ regexp , $ selector = '' , $ markup = '' , $ message = '' )
166
- {
189
+ public function assertElementRegExp (
190
+ string $ regexp ,
191
+ $ selector = '' ,
192
+ string $ markup = '' ,
193
+ string $ message = ''
194
+ ) {
167
195
$ constraint = new ElementMatchesRegExp (new Selector ($ selector ), $ regexp );
168
196
169
197
static ::assertThat ($ markup , $ constraint , $ message );
@@ -174,15 +202,19 @@ public function assertElementRegExp($regexp, $selector = '', $markup = '', $mess
174
202
*
175
203
* @since 1.1.0
176
204
*
177
- * @param string $regexp The regular expression pattern to look for within the DOM node.
178
- * @param string $selector A query selector for the element to find .
179
- * @param string $markup The output that should not contain the $selector.
180
- * @param string $message A message to display if the assertion fails.
205
+ * @param string $regexp The regular expression pattern to look for within the DOM node.
206
+ * @param string|array<string, scalar> $selector A query selector to search for .
207
+ * @param string $markup The output that should not contain the $selector.
208
+ * @param string $message A message to display if the assertion fails.
181
209
*
182
210
* @return void
183
211
*/
184
- public function assertElementNotRegExp ($ regexp , $ selector = '' , $ markup = '' , $ message = '' )
185
- {
212
+ public function assertElementNotRegExp (
213
+ string $ regexp ,
214
+ $ selector = '' ,
215
+ string $ markup = '' ,
216
+ string $ message = ''
217
+ ) {
186
218
$ constraint = new LogicalNot (new ElementMatchesRegExp (new Selector ($ selector ), $ regexp ));
187
219
188
220
static ::assertThat ($ markup , $ constraint , $ message );
0 commit comments