public function testGetCompiled() { Query::setCompiled([]); $selector = '.post h2'; $xpath = '//*[contains(concat(" ", normalize-space(@class), " "), " post ")]//h2'; $compiled = [$selector => $xpath]; Query::compile($selector); $this->assertEquals($compiled, Query::getCompiled()); }
public function testGetCompiled() { Query::setCompiled([]); $selector = '#foo .bar baz'; $xpath = '//*[@id="foo"]//*[contains(concat(" ", normalize-space(@class), " "), " bar ")]//baz'; $compiled = [$selector => $xpath]; Query::compile($selector); $this->assertEquals($compiled, Query::getCompiled()); }
public function testGetCompiled() { Query::setCompiled([]); $selector = '.post h2'; $xpath = "//*[contains(concat(' ', normalize-space(@class), ' '), ' post ')]"; $compiled = [$selector => $xpath]; $xpath = Query::compile($selector); $compiled = Query::getCompiled(); $this->assertEquals($compiled, Query::getCompiled()); }
public function testGetCompiled() { Query::setCompiled([]); $selector = '.post h2'; $xpath = Query::compile($selector); $compiled = Query::getCompiled(); $this->assertTrue(is_array($compiled)); $this->assertEquals(1, count($compiled)); $this->assertTrue(array_key_exists($selector, $compiled)); $this->assertEquals($xpath, $compiled[$selector]); }