示例#1
0
 public function testAttributeCallback()
 {
     $called = 0;
     $cb = function () use(&$called) {
         $called++;
         return false;
     };
     $config = new Config();
     $config->addAttributeCallback($cb);
     $scanner = new Scanner($config);
     $scanner->start();
     $output = $scanner->scan("<a href='http://blah.com'>blah</a>");
     $output .= $scanner->end();
     $this->assertEquals(1, $called);
     $this->assertEquals("<a>blah</a>", $output);
 }