55
66This library introduces the ` MarkupAssertionsTrait ` trait for use in [ PHPUnit] ( https://phpunit.de ) tests.
77
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 .
99
1010## Example
1111
@@ -22,10 +22,10 @@ class MyUnitTest extends TestCase
2222 */
2323 public function testRenderFormContainsInputs()
2424 {
25- $output = render_form();
25+ $markup = render_form();
2626
27- $this->assertContainsSelector('#first-name', $output );
28- $this->assertContainsSelector('#last-name', $output );
27+ $this->assertContainsSelector('#first-name', $markup );
28+ $this->assertContainsSelector('#last-name', $markup );
2929 }
3030}
3131```
@@ -104,8 +104,8 @@ Assert that the given string contains an element matching the given selector.
104104<dl >
105105 <dt>(string) $selector</dt>
106106 <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>
109109 <dt>(string) $message</dt>
110110 <dd>A message to display if the assertion fails.</dd>
111111</dl >
@@ -130,8 +130,8 @@ This method is the inverse of [`assertContainsSelector()`](#assertcontainsselect
130130<dl >
131131 <dt>(string) $selector</dt>
132132 <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>
135135 <dt>(string) $message</dt>
136136 <dd>A message to display if the assertion fails.</dd>
137137</dl >
@@ -145,7 +145,7 @@ Assert the number of times an element matching the given selector is found.
145145 <dd>The number of matching elements expected.</dd>
146146 <dt>(string) $selector</dt>
147147 <dd>A query selector for the element to find.</dd>
148- <dt>(string) $output </dt>
148+ <dt>(string) $markup </dt>
149149 <dd>The markup to run the assertion against.</dd>
150150 <dt>(string) $message</dt>
151151 <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.
171171<dl >
172172 <dt>(array) $attributes</dt>
173173 <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>
176176 <dt>(string) $message</dt>
177177 <dd>A message to display if the assertion fails.</dd>
178178</dl >
@@ -203,8 +203,8 @@ Assert that an element with the given attributes does not exist in the given mar
203203<dl >
204204 <dt>(array) $attributes</dt>
205205 <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>
208208 <dt>(string) $message</dt>
209209 <dd>A message to display if the assertion fails.</dd>
210210</dl >
@@ -218,8 +218,8 @@ Assert that the element with the given selector contains a string.
218218 <dd>The string to look for within the DOM node's contents.</dd>
219219 <dt>(string) $selector</dt>
220220 <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>
223223 <dt>(string) $message</dt>
224224 <dd>A message to display if the assertion fails.</dd>
225225</dl >
@@ -252,8 +252,8 @@ This method is the inverse of [`assertElementContains()`](#assertelementcontains
252252 <dd>The string to look for within the DOM node's contents.</dd>
253253 <dt>(string) $selector</dt>
254254 <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>
257257 <dt>(string) $message</dt>
258258 <dd>A message to display if the assertion fails.</dd>
259259</dl >
@@ -269,8 +269,8 @@ This method works just like [`assertElementContains()`](#assertelementcontains),
269269 <dd>The regular expression pattern to look for within the DOM node.</dd>
270270 <dt>(string) $selector</dt>
271271 <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>
274274 <dt>(string) $message</dt>
275275 <dd>A message to display if the assertion fails.</dd>
276276</dl >
@@ -286,8 +286,8 @@ This method is the inverse of [`assertElementRegExp()`](#assertelementregexp) an
286286 <dd>The regular expression pattern to look for within the DOM node.</dd>
287287 <dt>(string) $selector</dt>
288288 <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>
291291 <dt>(string) $message</dt>
292292 <dd>A message to display if the assertion fails.</dd>
293293</dl >
0 commit comments