Level 70
@amoktar does it work for you?
public function test_html()
{
$result = do_something();
$dom = $this->dom( $result );
$this->assertSame( 1, count( $dom->filter( '.col-3' ) ) );
$this->assertSame( 6, count( $dom->filter( 'section.item' ) ) );
}
Ref: https://takayukimiyauchi.jp/2018/04/02/test-the-html-with-dom-parser-and-phpunit/
2 likes