public function testWhitewashingHeaders() { $parser = new PHPricot_Parser(); $doc = $parser->parse(file_get_contents(dirname(__FILE__) . "/_files/whitewashing.html")); $cssHandler = new PHPricot_CssParser_EventHandler($doc); $cssParser = new CssParser('div.box h2', $cssHandler); $cssParser->parse(); $headers = $cssHandler->getMatches(); $this->assertEquals(10, count($headers), "Whitewashing Main Page example should have 10 h2 tags"); }
public function search($cssSelector) { $cssHandler = new PHPricot_CssParser_EventHandler($this->doc); $cssParser = new CssParser($cssSelector, $cssHandler); $cssParser->parse(); return new PHPricot_Query($cssHandler->getMatches()); }