Ejemplo n.º 1
0
 function testBlock()
 {
     $wr = new \WikiRenderer\Renderer(new \WikiRenderer\Markup\WR3Html\Config());
     foreach ($this->listblocks as $file => $nberror) {
         $sourceFile = 'datasblocks/' . $file . '.src';
         $resultFile = 'datasblocks/' . $file . '.res';
         $source = file_get_contents($sourceFile);
         $result = file_get_contents($resultFile);
         $res = $wr->render($source);
         if ($file == 'wr3_footnote') {
             $conf =& $wr->getConfig();
             $res = str_replace('-' . $conf->footnotesId . '-', '-XXX-', $res);
         }
         $this->assertEquals($result, $res, "error on {$file}");
         $this->assertEquals($nberror, count($wr->errors), "Errors detected by wr!");
     }
 }
 function testBlockFiles()
 {
     $wr = new \WikiRenderer\Renderer(new \WikiRenderer\Markup\DokuHtml\Config());
     foreach ($this->listblocks as $file => $nberror) {
         $sourceFile = 'datasblocks/doku_xhtml_' . $file . '.src';
         $resultFile = 'datasblocks/doku_xhtml_' . $file . '.res';
         $handle = fopen($sourceFile, "r");
         $source = fread($handle, filesize($sourceFile));
         fclose($handle);
         $handle = fopen($resultFile, "r");
         $result = fread($handle, filesize($resultFile));
         fclose($handle);
         $res = $wr->render($source);
         if ($file == 'general') {
             $conf =& $wr->getConfig();
             $res = str_replace('-' . $conf->footnotesId . '-', '-XXX-', $res);
         }
         $this->assertEquals($result, $res, "error on {$file}");
         $this->assertEquals($nberror, count($wr->errors), "Errors detected by wr");
     }
 }