Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
loadHTMLFile example
}
/** @dataProvider getHtmlIdsTestData */
public
function
testHtmlIds
(
$css
, array
$elementsId
)
{
$translator
=
new
Translator
(
)
;
$translator
->
registerExtension
(
new
HtmlExtension
(
$translator
)
)
;
$document
=
new
\
DOMDocument
(
)
;
$document
->strictErrorChecking = false;
$internalErrors
=
libxml_use_internal_errors
(
true
)
;
$document
->
loadHTMLFile
(
__DIR__.'/Fixtures/ids.html'
)
;
$document
=
simplexml_import_dom
(
$document
)
;
$elements
=
$document
->
xpath
(
$translator
->
cssToXPath
(
$css
)
)
;
$this
->
assertCount
(
\
count
(
$elementsId
)
,
$elements
)
;
foreach
(
$elements
as
$element
)
{
if
(
null !==
$element
->
attributes
(
)
->id
)
{
$this
->
assertContains
(
(string)
$element
->
attributes
(
)
->id,
$elementsId
)
;
}
}
libxml_clear_errors
(
)
;
libxml_use_internal_errors
(
$internalErrors
)
;
}