Skip to content

Add HTML assertion support !

Compare
Choose a tag to compare
@shulard shulard released this 27 Feb 13:58
· 5 commits to master since this release

Now you can use the new html handler to perform document validation on each HTML document.

Use it

<?php
namespace shulard\example\xml;

use atoum;

class foo extends atoum\test
{
    public function testOnHtmlDocument()
    {
        $this
            ->then
                ->html(file_get_contents('http://example.com'))
                ->isValidAgainstSchema
                    ->dtd('http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd', 'html')
                ->parent
                ->xpath('//title')
                    ->item(0)
                        ->nodevalue
                            ->isEqualTo('My awesome title')
                ->xpath('//body/script')
                    ->last()
                        ->nodevalue
                            ->contains('GMTXXXXXX');
        ;
    }
}