コード例 #1
0
 /**
  * Get FluentDOMStyle instance with loaded html document using a mock loader
  *
  * @return FluentDOMStyle
  */
 protected function getFluentDOMStyleFixture($string = NULL, $xpath = NULL)
 {
     $fd = new FluentDOMStyle();
     if (!empty($string)) {
         $dom = new DOMDocument();
         $dom->loadXML($string);
         $loader = $this->getMock('FluentDOMLoader');
         $loader->expects($this->once())->method('load')->with($this->equalTo(''))->will($this->returnValue($dom));
         $fd->setLoaders(array($loader));
         $fd->load('');
         if (!empty($xpath)) {
             $query = new DOMXPath($dom);
             $nodes = $query->evaluate($xpath);
             $fd = $fd->spawn();
             $fd->push($nodes);
         }
     }
     return $fd;
 }