Skip to content

Commit 79e9648

Browse files
committed
Update $output to $markup, improve inline docs
1 parent 127dd9a commit 79e9648

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

src/MarkupAssertionsTrait.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ trait MarkupAssertionsTrait
2121
* @since 1.0.0
2222
*
2323
* @param string $selector A query selector for the element to find.
24-
* @param string $output The output that should contain the $selector.
24+
* @param string $markup The output that should contain the $selector.
2525
* @param string $message A message to display if the assertion fails.
2626
*
2727
* @return void
2828
*/
29-
public function assertContainsSelector($selector, $output = '', $message = '')
29+
public function assertContainsSelector($selector, $markup = '', $message = '')
3030
{
31-
$results = $this->executeDomQuery($output, $selector);
31+
$results = $this->executeDomQuery($markup, $selector);
3232

3333
$this->assertGreaterThan(0, count($results), $message);
3434
}
@@ -39,12 +39,12 @@ public function assertContainsSelector($selector, $output = '', $message = '')
3939
* @since 1.0.0
4040
*
4141
* @param string $selector A query selector for the element to find.
42-
* @param string $output The output that should not contain the $selector.
42+
* @param string $markup The output that should not contain the $selector.
4343
* @param string $message A message to display if the assertion fails.
4444
*/
45-
public function assertNotContainsSelector($selector, $output = '', $message = '')
45+
public function assertNotContainsSelector($selector, $markup = '', $message = '')
4646
{
47-
$results = $this->executeDomQuery($output, $selector);
47+
$results = $this->executeDomQuery($markup, $selector);
4848

4949
$this->assertEquals(0, count($results), $message);
5050
}
@@ -56,14 +56,14 @@ public function assertNotContainsSelector($selector, $output = '', $message = ''
5656
*
5757
* @param int $count The number of matching elements expected.
5858
* @param string $selector A query selector for the element to find.
59-
* @param string $output The markup to run the assertion against.
59+
* @param string $markup The markup to run the assertion against.
6060
* @param string $message A message to display if the assertion fails.
6161
*
6262
* @return void
6363
*/
64-
public function assertSelectorCount($count, $selector, $output = '', $message = '')
64+
public function assertSelectorCount($count, $selector, $markup = '', $message = '')
6565
{
66-
$results = $this->executeDomQuery($output, $selector);
66+
$results = $this->executeDomQuery($markup, $selector);
6767

6868
$this->assertCount($count, $results, $message);
6969
}
@@ -74,17 +74,17 @@ public function assertSelectorCount($count, $selector, $output = '', $message =
7474
* @since 1.0.0
7575
*
7676
* @param array $attributes An array of HTML attributes that should be found on the element.
77-
* @param string $output The output that should contain an element with the
77+
* @param string $markup The output that should contain an element with the
7878
* provided $attributes.
7979
* @param string $message A message to display if the assertion fails.
8080
*
8181
* @return void
8282
*/
83-
public function assertHasElementWithAttributes($attributes = [], $output = '', $message = '')
83+
public function assertHasElementWithAttributes($attributes = [], $markup = '', $message = '')
8484
{
8585
$this->assertContainsSelector(
8686
'*' . $this->flattenAttributeArray($attributes),
87-
$output,
87+
$markup,
8888
$message
8989
);
9090
}
@@ -95,17 +95,17 @@ public function assertHasElementWithAttributes($attributes = [], $output = '', $
9595
* @since 1.0.0
9696
*
9797
* @param array $attributes An array of HTML attributes that should be found on the element.
98-
* @param string $output The output that should not contain an element with the
98+
* @param string $markup The output that should not contain an element with the
9999
* provided $attributes.
100100
* @param string $message A message to display if the assertion fails.
101101
*
102102
* @return void
103103
*/
104-
public function assertNotHasElementWithAttributes($attributes = [], $output = '', $message = '')
104+
public function assertNotHasElementWithAttributes($attributes = [], $markup = '', $message = '')
105105
{
106106
$this->assertNotContainsSelector(
107107
'*' . $this->flattenAttributeArray($attributes),
108-
$output,
108+
$markup,
109109
$message
110110
);
111111
}
@@ -117,20 +117,20 @@ public function assertNotHasElementWithAttributes($attributes = [], $output = ''
117117
*
118118
* @param string $contents The string to look for within the DOM node's contents.
119119
* @param string $selector A query selector for the element to find.
120-
* @param string $output The output that should contain the $selector.
120+
* @param string $markup The output that should contain the $selector.
121121
* @param string $message A message to display if the assertion fails.
122122
*
123123
* @return void
124124
*/
125-
public function assertElementContains($contents, $selector = '', $output = '', $message = '')
125+
public function assertElementContains($contents, $selector = '', $markup = '', $message = '')
126126
{
127127
$method = method_exists($this, 'assertStringContainsString')
128128
? 'assertStringContainsString'
129129
: 'assertContains';
130130

131131
$this->$method(
132132
$contents,
133-
$this->getInnerHtmlOfMatchedElements($output, $selector),
133+
$this->getInnerHtmlOfMatchedElements($markup, $selector),
134134
$message
135135
);
136136
}
@@ -142,20 +142,20 @@ public function assertElementContains($contents, $selector = '', $output = '', $
142142
*
143143
* @param string $contents The string to look for within the DOM node's contents.
144144
* @param string $selector A query selector for the element to find.
145-
* @param string $output The output that should not contain the $selector.
145+
* @param string $markup The output that should not contain the $selector.
146146
* @param string $message A message to display if the assertion fails.
147147
*
148148
* @return void
149149
*/
150-
public function assertElementNotContains($contents, $selector = '', $output = '', $message = '')
150+
public function assertElementNotContains($contents, $selector = '', $markup = '', $message = '')
151151
{
152152
$method = method_exists($this, 'assertStringNotContainsString')
153153
? 'assertStringNotContainsString'
154154
: 'assertNotContains';
155155

156156
$this->$method(
157157
$contents,
158-
$this->getInnerHtmlOfMatchedElements($output, $selector),
158+
$this->getInnerHtmlOfMatchedElements($markup, $selector),
159159
$message
160160
);
161161
}
@@ -167,20 +167,20 @@ public function assertElementNotContains($contents, $selector = '', $output = ''
167167
*
168168
* @param string $regexp The regular expression pattern to look for within the DOM node.
169169
* @param string $selector A query selector for the element to find.
170-
* @param string $output The output that should contain the $selector.
170+
* @param string $markup The output that should contain the $selector.
171171
* @param string $message A message to display if the assertion fails.
172172
*
173173
* @return void
174174
*/
175-
public function assertElementRegExp($regexp, $selector = '', $output = '', $message = '')
175+
public function assertElementRegExp($regexp, $selector = '', $markup = '', $message = '')
176176
{
177177
$method = method_exists($this, 'assertMatchesRegularExpression')
178178
? 'assertMatchesRegularExpression'
179179
: 'assertRegExp';
180180

181181
$this->$method(
182182
$regexp,
183-
$this->getInnerHtmlOfMatchedElements($output, $selector),
183+
$this->getInnerHtmlOfMatchedElements($markup, $selector),
184184
$message
185185
);
186186
}
@@ -192,20 +192,20 @@ public function assertElementRegExp($regexp, $selector = '', $output = '', $mess
192192
*
193193
* @param string $regexp The regular expression pattern to look for within the DOM node.
194194
* @param string $selector A query selector for the element to find.
195-
* @param string $output The output that should not contain the $selector.
195+
* @param string $markup The output that should not contain the $selector.
196196
* @param string $message A message to display if the assertion fails.
197197
*
198198
* @return void
199199
*/
200-
public function assertElementNotRegExp($regexp, $selector = '', $output = '', $message = '')
200+
public function assertElementNotRegExp($regexp, $selector = '', $markup = '', $message = '')
201201
{
202202
$method = method_exists($this, 'assertDoesNotMatchRegularExpression')
203203
? 'assertDoesNotMatchRegularExpression'
204204
: 'assertNotRegExp';
205205

206206
$this->$method(
207207
$regexp,
208-
$this->getInnerHtmlOfMatchedElements($output, $selector),
208+
$this->getInnerHtmlOfMatchedElements($markup, $selector),
209209
$message
210210
);
211211
}

tests/MarkupAssertionsTraitTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ public function provideAttributes()
287287

288288
/**
289289
* Data provider for testGetInnerHtmlOfMatchedElements().
290+
*
291+
* @return array<string,array<string>>
290292
*/
291293
public function provideInnerHtml()
292294
{
@@ -311,6 +313,8 @@ public function provideInnerHtml()
311313

312314
/**
313315
* Data provider for testAssertContainsSelector().
316+
*
317+
* @return array<string,array<string>>
314318
*/
315319
public function provideSelectorVariants()
316320
{

0 commit comments

Comments
 (0)