Skip to content

Commit 1231d75

Browse files
victor-prdhnicolas-grekas
authored andcommitted
[DomCrawler] Improve html5Parser tests
1 parent dc01681 commit 1231d75

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Symfony/Component/DomCrawler/Tests/Html5ParserCrawlerTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,24 @@ public function testHtml5ParserNotSameAsNativeParserForSpecificHtml()
6060
$this->assertNotEquals($nativeCrawler->filterXPath('//h1')->text(), $html5Crawler->filterXPath('//h1')->text(), 'Native parser and Html5 parser must be different');
6161
}
6262

63+
/**
64+
* @testWith [true]
65+
* [false]
66+
*/
67+
public function testHasHtml5Parser(bool $useHtml5Parser)
68+
{
69+
$crawler = $this->createCrawler(null, null, null, $useHtml5Parser);
70+
71+
$r = new \ReflectionProperty($crawler::class, 'html5Parser');
72+
$html5Parser = $r->getValue($crawler);
73+
74+
if ($useHtml5Parser) {
75+
$this->assertInstanceOf(\Masterminds\HTML5::class, $html5Parser, 'Html5Parser must be a Masterminds\HTML5 instance');
76+
} else {
77+
$this->assertNull($html5Parser, 'Html5Parser must be null');
78+
}
79+
}
80+
6381
public static function validHtml5Provider(): iterable
6482
{
6583
$html = self::getDoctype().'<html><body><h1><p>Foo</p></h1></body></html>';

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy