@@ -19,7 +19,7 @@ class MarkupAssertionsTraitTest extends TestCase
19
19
* @testdox assertContainsSelector() should find matching selectors
20
20
* @dataProvider provideSelectorVariants
21
21
*/
22
- public function assertContainsSelector_should_find_matching_selectors ($ selector )
22
+ public function assertContainsSelector_should_find_matching_selectors (string $ selector ): void
23
23
{
24
24
$ this ->assertContainsSelector (
25
25
$ selector ,
@@ -31,7 +31,7 @@ public function assertContainsSelector_should_find_matching_selectors($selector)
31
31
* @test
32
32
* @testdox assertContainsSelector() should pick up multiple instances of a selector
33
33
*/
34
- public function assertContainsSelector_should_pick_up_multiple_instances ()
34
+ public function assertContainsSelector_should_pick_up_multiple_instances (): void
35
35
{
36
36
$ this ->assertContainsSelector (
37
37
'a ' ,
@@ -44,8 +44,9 @@ public function assertContainsSelector_should_pick_up_multiple_instances()
44
44
* @testdox assertNotContainsSelector() should verify that the given selector does not exist
45
45
* @dataProvider provideSelectorVariants
46
46
*/
47
- public function assertNotContainsSelector_should_verify_that_the_given_selector_does_not_exist ($ selector )
48
- {
47
+ public function assertNotContainsSelector_should_verify_that_the_given_selector_does_not_exist (
48
+ string $ selector
49
+ ): void {
49
50
$ this ->assertNotContainsSelector (
50
51
$ selector ,
51
52
'<h1 id="page-title" class="foo bar">This element has little to do with the link.</h1> '
@@ -56,7 +57,7 @@ public function assertNotContainsSelector_should_verify_that_the_given_selector_
56
57
* @test
57
58
* @testdox assertSelectorCount() should count the instances of a selector
58
59
*/
59
- public function assertSelectorCount_should_count_the_number_of_instances ()
60
+ public function assertSelectorCount_should_count_the_number_of_instances (): void
60
61
{
61
62
$ this ->assertSelectorCount (
62
63
3 ,
@@ -69,7 +70,7 @@ public function assertSelectorCount_should_count_the_number_of_instances()
69
70
* @test
70
71
* @testdox assertHasElementWithAttributes() should find an element with the given attributes
71
72
*/
72
- public function assertHasElementWithAttributes_should_find_elements_with_matching_attributes ()
73
+ public function assertHasElementWithAttributes_should_find_elements_with_matching_attributes (): void
73
74
{
74
75
$ this ->assertHasElementWithAttributes (
75
76
[
@@ -85,7 +86,7 @@ public function assertHasElementWithAttributes_should_find_elements_with_matchin
85
86
* @testdox assertHasElementWithAttributes() should be able to parse spaces in attribute values
86
87
* @ticket https://github.com/stevegrunwell/phpunit-markup-assertions/issues/13
87
88
*/
88
- public function assertHasElementWithAttributes_should_be_able_to_handle_spaces ()
89
+ public function assertHasElementWithAttributes_should_be_able_to_handle_spaces (): void
89
90
{
90
91
$ this ->assertHasElementWithAttributes (
91
92
[
@@ -99,7 +100,7 @@ public function assertHasElementWithAttributes_should_be_able_to_handle_spaces()
99
100
* @test
100
101
* @testdox assertNotHasElementWithAttributes() should ensure no element has the provided attributes
101
102
*/
102
- public function assertNotHasElementWithAttributes_should_find_no_elements_with_matching_attributes ()
103
+ public function assertNotHasElementWithAttributes_should_find_no_elements_with_matching_attributes (): void
103
104
{
104
105
$ this ->assertNotHasElementWithAttributes (
105
106
[
@@ -114,7 +115,7 @@ public function assertNotHasElementWithAttributes_should_find_no_elements_with_m
114
115
* @test
115
116
* @testdox assertElementContains() should be able to search for a selector
116
117
*/
117
- public function assertElementContains_can_match_a_selector ()
118
+ public function assertElementContains_can_match_a_selector (): void
118
119
{
119
120
$ this ->assertElementContains (
120
121
'ipsum ' ,
@@ -127,7 +128,7 @@ public function assertElementContains_can_match_a_selector()
127
128
* @test
128
129
* @testdox assertElementContains() should be able to chain multiple selectors
129
130
*/
130
- public function assertElementContains_can_chain_multiple_selectors ()
131
+ public function assertElementContains_can_chain_multiple_selectors (): void
131
132
{
132
133
$ this ->assertElementContains (
133
134
'ipsum ' ,
@@ -140,7 +141,7 @@ public function assertElementContains_can_chain_multiple_selectors()
140
141
* @test
141
142
* @testdox assertElementContains() should scope text to the selected element
142
143
*/
143
- public function assertElementContains_should_scope_matches_to_selector ()
144
+ public function assertElementContains_should_scope_matches_to_selector (): void
144
145
{
145
146
$ this ->expectException (AssertionFailedError::class);
146
147
$ this ->expectExceptionMessage ('The #main div does not contain the string "ipsum". ' );
@@ -159,7 +160,7 @@ public function assertElementContains_should_scope_matches_to_selector()
159
160
* @dataProvider provideGreetingsInDifferentLanguages
160
161
* @ticket https://github.com/stevegrunwell/phpunit-markup-assertions/issues/31
161
162
*/
162
- public function assertElementContains_should_handle_various_character_sets ($ greeting )
163
+ public function assertElementContains_should_handle_various_character_sets (string $ greeting ): void
163
164
{
164
165
$ this ->assertElementContains (
165
166
$ greeting ,
@@ -172,7 +173,7 @@ public function assertElementContains_should_handle_various_character_sets($gree
172
173
* @test
173
174
* @testdox assertElementNotContains() should be able to search for a selector
174
175
*/
175
- public function assertElementNotContains_can_match_a_selector ()
176
+ public function assertElementNotContains_can_match_a_selector (): void
176
177
{
177
178
$ this ->assertElementNotContains (
178
179
'ipsum ' ,
@@ -187,7 +188,7 @@ public function assertElementNotContains_can_match_a_selector()
187
188
* @dataProvider provideGreetingsInDifferentLanguages
188
189
* @ticket https://github.com/stevegrunwell/phpunit-markup-assertions/issues/31
189
190
*/
190
- public function assertElementNotContains_should_handle_various_character_sets ($ greeting )
191
+ public function assertElementNotContains_should_handle_various_character_sets (string $ greeting ): void
191
192
{
192
193
$ this ->assertElementNotContains (
193
194
$ greeting ,
@@ -200,7 +201,7 @@ public function assertElementNotContains_should_handle_various_character_sets($g
200
201
* @test
201
202
* @testdox assertElementRegExp() should use regular expression matching
202
203
*/
203
- public function assertElementRegExp_should_use_regular_expression_matching ()
204
+ public function assertElementRegExp_should_use_regular_expression_matching (): void
204
205
{
205
206
$ this ->assertElementRegExp (
206
207
'/[A-Z0-9-]+/ ' ,
@@ -213,7 +214,7 @@ public function assertElementRegExp_should_use_regular_expression_matching()
213
214
* @test
214
215
* @testdox assertElementRegExp() should be able to search for nested contents
215
216
*/
216
- public function assertElementRegExp_should_be_able_to_match_nested_contents ()
217
+ public function assertElementRegExp_should_be_able_to_match_nested_contents (): void
217
218
{
218
219
$ this ->assertElementRegExp (
219
220
'/[A-Z]+/ ' ,
@@ -226,7 +227,7 @@ public function assertElementRegExp_should_be_able_to_match_nested_contents()
226
227
* @test
227
228
* @testdox assertElementNotRegExp() should use regular expression matching
228
229
*/
229
- public function testAssertElementNotRegExp ()
230
+ public function testAssertElementNotRegExp (): void
230
231
{
231
232
$ this ->assertElementNotRegExp (
232
233
'/[0-9-]+/ ' ,
@@ -240,8 +241,10 @@ public function testAssertElementNotRegExp()
240
241
* @test
241
242
* @testdox flattenAttributeArray() should flatten an array of attributes
242
243
* @dataProvider provideAttributes
244
+ *
245
+ * @param array<string,string> $attributes
243
246
*/
244
- public function flattenArrayAttribute_should_flatten_arrays_of_attributes ($ attributes , $ expected )
247
+ public function flattenArrayAttribute_should_flatten_arrays_of_attributes (array $ attributes , string $ expected ): void
245
248
{
246
249
$ method = new \ReflectionMethod ($ this , 'flattenAttributeArray ' );
247
250
$ method ->setAccessible (true );
@@ -254,7 +257,7 @@ public function flattenArrayAttribute_should_flatten_arrays_of_attributes($attri
254
257
* @testdox flattenAttributeArray() should throw a RiskyTestError if the array is empty
255
258
* @dataProvider provideAttributes
256
259
*/
257
- public function flattenAttributeArray_should_throw_a_RiskyTestError_if_given_an_empty_array ()
260
+ public function flattenAttributeArray_should_throw_a_RiskyTestError_if_given_an_empty_array (): void
258
261
{
259
262
$ this ->expectException (RiskyTestError::class);
260
263
@@ -268,8 +271,11 @@ public function flattenAttributeArray_should_throw_a_RiskyTestError_if_given_an_
268
271
* @testdox getInnerHtmlOfMatchedElements() should retrieve the inner HTML
269
272
* @dataProvider provideInnerHtml
270
273
*/
271
- public function getInnerHtmlOfMatchedElements_should_retrieve_the_inner_HTML ($ markup , $ selector , $ expected )
272
- {
274
+ public function getInnerHtmlOfMatchedElements_should_retrieve_the_inner_HTML (
275
+ string $ markup ,
276
+ string $ selector ,
277
+ string $ expected
278
+ ): void {
273
279
$ method = new \ReflectionMethod ($ this , 'getInnerHtmlOfMatchedElements ' );
274
280
$ method ->setAccessible (true );
275
281
@@ -278,8 +284,10 @@ public function getInnerHtmlOfMatchedElements_should_retrieve_the_inner_HTML($ma
278
284
279
285
/**
280
286
* Data provider for testFlattenAttributeArray().
287
+ *
288
+ * @return array<string,array{array<string,string>,string}>
281
289
*/
282
- public function provideAttributes ()
290
+ public function provideAttributes (): array
283
291
{
284
292
return [
285
293
'Single attribute ' => [
@@ -321,7 +329,7 @@ public function provideAttributes()
321
329
*
322
330
* @return array<string,array<string>>
323
331
*/
324
- public function provideInnerHtml ()
332
+ public function provideInnerHtml (): array
325
333
{
326
334
return [
327
335
'A single match ' => [
@@ -347,7 +355,7 @@ public function provideInnerHtml()
347
355
*
348
356
* @return array<string,array<string>>
349
357
*/
350
- public function provideSelectorVariants ()
358
+ public function provideSelectorVariants (): array
351
359
{
352
360
return [
353
361
'Simple tag name ' => ['a ' ],
@@ -365,7 +373,7 @@ public function provideSelectorVariants()
365
373
*
366
374
* @return array<string,array<string>>
367
375
*/
368
- public function provideGreetingsInDifferentLanguages ()
376
+ public function provideGreetingsInDifferentLanguages (): array
369
377
{
370
378
return [
371
379
'Arabic ' => ['مرحبا! ' ],
0 commit comments