5
5
6
6
This library introduces the ` MarkupAssertionsTrait ` trait for use in [ PHPUnit] ( https://phpunit.de ) tests.
7
7
8
- These assertions enable you to inspect generated markup without having to muddy tests with [ ` DOMDocument ` ] ( http://php.net/manual/en/class.domdocument.php ) or nasty regular expressions. If you're generating markup at all with PHP, the PHPUnit Markup Assertions trait aims to make the output testable.
8
+ These assertions enable you to inspect generated markup without having to muddy tests with [ ` DOMDocument ` ] ( http://php.net/manual/en/class.domdocument.php ) or nasty regular expressions. If you're generating markup at all with PHP, the PHPUnit Markup Assertions trait aims to make the output testable without making your tests fragile .
9
9
10
10
## Example
11
11
@@ -22,10 +22,10 @@ class MyUnitTest extends TestCase
22
22
*/
23
23
public function testRenderFormContainsInputs()
24
24
{
25
- $output = render_form();
25
+ $markup = render_form();
26
26
27
- $this->assertContainsSelector('#first-name', $output );
28
- $this->assertContainsSelector('#last-name', $output );
27
+ $this->assertContainsSelector('#first-name', $markup );
28
+ $this->assertContainsSelector('#last-name', $markup );
29
29
}
30
30
}
31
31
```
@@ -104,8 +104,8 @@ Assert that the given string contains an element matching the given selector.
104
104
<dl >
105
105
<dt>(string) $selector</dt>
106
106
<dd>A query selector for the element to find.</dd>
107
- <dt>(string) $output </dt>
108
- <dd>The output that should contain the <code>$selector</code>.</dd>
107
+ <dt>(string) $markup </dt>
108
+ <dd>The markup that should contain the <code>$selector</code>.</dd>
109
109
<dt>(string) $message</dt>
110
110
<dd>A message to display if the assertion fails.</dd>
111
111
</dl >
@@ -130,8 +130,8 @@ This method is the inverse of [`assertContainsSelector()`](#assertcontainsselect
130
130
<dl >
131
131
<dt>(string) $selector</dt>
132
132
<dd>A query selector for the element to find.</dd>
133
- <dt>(string) $output </dt>
134
- <dd>The output that should not contain the <code>$selector</code>.</dd>
133
+ <dt>(string) $markup </dt>
134
+ <dd>The markup that should not contain the <code>$selector</code>.</dd>
135
135
<dt>(string) $message</dt>
136
136
<dd>A message to display if the assertion fails.</dd>
137
137
</dl >
@@ -145,7 +145,7 @@ Assert the number of times an element matching the given selector is found.
145
145
<dd>The number of matching elements expected.</dd>
146
146
<dt>(string) $selector</dt>
147
147
<dd>A query selector for the element to find.</dd>
148
- <dt>(string) $output </dt>
148
+ <dt>(string) $markup </dt>
149
149
<dd>The markup to run the assertion against.</dd>
150
150
<dt>(string) $message</dt>
151
151
<dd>A message to display if the assertion fails.</dd>
@@ -171,8 +171,8 @@ Assert that an element with the given attributes exists in the given markup.
171
171
<dl >
172
172
<dt>(array) $attributes</dt>
173
173
<dd>An array of HTML attributes that should be found on the element.</dd>
174
- <dt>(string) $output </dt>
175
- <dd>The output that should contain an element with the provided <code>$attributes</code>.</dd>
174
+ <dt>(string) $markup </dt>
175
+ <dd>The markup that should contain an element with the provided <code>$attributes</code>.</dd>
176
176
<dt>(string) $message</dt>
177
177
<dd>A message to display if the assertion fails.</dd>
178
178
</dl >
@@ -203,8 +203,8 @@ Assert that an element with the given attributes does not exist in the given mar
203
203
<dl >
204
204
<dt>(array) $attributes</dt>
205
205
<dd>An array of HTML attributes that should not be found on the element.</dd>
206
- <dt>(string) $output </dt>
207
- <dd>The output that should not contain an element with the provided <code>$attributes</code>.</dd>
206
+ <dt>(string) $markup </dt>
207
+ <dd>The markup that should not contain an element with the provided <code>$attributes</code>.</dd>
208
208
<dt>(string) $message</dt>
209
209
<dd>A message to display if the assertion fails.</dd>
210
210
</dl >
@@ -218,8 +218,8 @@ Assert that the element with the given selector contains a string.
218
218
<dd>The string to look for within the DOM node's contents.</dd>
219
219
<dt>(string) $selector</dt>
220
220
<dd>A query selector for the element to find.</dd>
221
- <dt>(string) $output </dt>
222
- <dd>The output that should contain the <code>$selector</code>.</dd>
221
+ <dt>(string) $markup </dt>
222
+ <dd>The markup that should contain the <code>$selector</code>.</dd>
223
223
<dt>(string) $message</dt>
224
224
<dd>A message to display if the assertion fails.</dd>
225
225
</dl >
@@ -252,8 +252,8 @@ This method is the inverse of [`assertElementContains()`](#assertelementcontains
252
252
<dd>The string to look for within the DOM node's contents.</dd>
253
253
<dt>(string) $selector</dt>
254
254
<dd>A query selector for the element to find.</dd>
255
- <dt>(string) $output </dt>
256
- <dd>The output that should contain the <code>$selector</code>.</dd>
255
+ <dt>(string) $markup </dt>
256
+ <dd>The markup that should contain the <code>$selector</code>.</dd>
257
257
<dt>(string) $message</dt>
258
258
<dd>A message to display if the assertion fails.</dd>
259
259
</dl >
@@ -269,8 +269,8 @@ This method works just like [`assertElementContains()`](#assertelementcontains),
269
269
<dd>The regular expression pattern to look for within the DOM node.</dd>
270
270
<dt>(string) $selector</dt>
271
271
<dd>A query selector for the element to find.</dd>
272
- <dt>(string) $output </dt>
273
- <dd>The output that should contain the <code>$selector</code>.</dd>
272
+ <dt>(string) $markup </dt>
273
+ <dd>The markup that should contain the <code>$selector</code>.</dd>
274
274
<dt>(string) $message</dt>
275
275
<dd>A message to display if the assertion fails.</dd>
276
276
</dl >
@@ -286,8 +286,8 @@ This method is the inverse of [`assertElementRegExp()`](#assertelementregexp) an
286
286
<dd>The regular expression pattern to look for within the DOM node.</dd>
287
287
<dt>(string) $selector</dt>
288
288
<dd>A query selector for the element to find.</dd>
289
- <dt>(string) $output </dt>
290
- <dd>The output that should contain the <code>$selector</code>.</dd>
289
+ <dt>(string) $markup </dt>
290
+ <dd>The markup that should contain the <code>$selector</code>.</dd>
291
291
<dt>(string) $message</dt>
292
292
<dd>A message to display if the assertion fails.</dd>
293
293
</dl >
0 commit comments