Skip to content
Permalink
Browse files

assertHtml() should accept whitespace before a closing tag.

Allow any amount of whitespace between tags.

Refs #10117
  • Loading branch information...
markstory committed Jan 28, 2017
1 parent 41b6e4b commit 9ed93ebe5f8952566820cb8094a12018c0c6a5d7
Showing with 19 additions and 1 deletion.
  1. +1 −1 src/TestSuite/TestCase.php
  2. +18 −0 tests/TestCase/TestSuite/AssertHtmlTest.php
@@ -401,7 +401,7 @@ public function assertHtml($expected, $string, $fullDebug = false)
}
$regex[] = [
sprintf('%sClose %s tag', $prefix[0], substr($tags, strlen($match[0]))),
sprintf('%s<[\s]*\/[\s]*%s[\s]*>[\n\r]*', $prefix[1], substr($tags, strlen($match[0]))),
sprintf('%s\s*<[\s]*\/[\s]*%s[\s]*>[\n\r]*', $prefix[1], substr($tags, strlen($match[0]))),
$i,
];
continue;
@@ -9,6 +9,24 @@
*/
class AssertHtmlTest extends TestCase
{
public function testAssertHtmlWhitespace()
{
$input = <<<HTML
<div class="wrapper">
<h4 class="widget-title">Popular tags
<i class="i-icon"></i>
</h4>
</div>
HTML;
$pattern = [
'div' => ['class' => 'wrapper'],
'h4' => ['class' => 'widget-title'], 'Popular tags',
'i' => ['class' => 'i-icon'], '/i',
'/h4',
'/div'
];
$this->assertHtml($pattern, $input);
}
/**
* test assertHtml works with single and double quotes
*

0 comments on commit 9ed93eb

Please sign in to comment.
You can’t perform that action at this time.