/**
  * @dataProvider getTestDocuments
  */
 public function testParseWikiFile($from, $to)
 {
     if (!is_file($to)) {
         $this->markTestSkipped("Comparision file '{$to}' not yet defined.");
     }
     $type = ucfirst(basename(dirname($from)));
     $tokenizerClass = 'ezcDocumentWiki' . $type . 'Tokenizer';
     $document = new ezcDocumentWiki();
     $document->options->errorReporting = E_PARSE | E_ERROR | E_WARNING;
     $document->options->tokenizer = new $tokenizerClass();
     $document->registerPlugin('currenttimeplugin', 'ezcDocumentTestDummyPlugin');
     $document->registerPlugin('calendar', 'ezcDocumentTestDummyPlugin');
     $document->registerPlugin('html', 'ezcDocumentTestDummyPlugin');
     $document->registerPlugin('php', 'ezcDocumentTestDummyPlugin');
     $document->loadFile($from);
     $docbook = $document->getAsDocbook();
     $xml = $docbook->save();
     // Store test file, to have something to compare on failure
     $tempDir = $this->createTempDir('wiki_visitor_' . $type . '_') . '/';
     file_put_contents($tempDir . basename($to), $xml);
     // Validate generated docbook
     $this->assertTrue($docbook->validateString($xml));
     $this->assertEquals(file_get_contents($to), $xml, 'Document not visited as expected.');
     // Remove tempdir, when nothing failed.
     $this->removeTempDir();
 }
Beispiel #2
0
<?php

require 'tutorial_autoload.php';
$document = new ezcDocumentWiki();
$document->loadString('
= Example text =

Just some exaple paragraph with a heading, some **emphasis** markup and a
[[http://ezcomponents.org|link]].');
$docbook = $document->getAsDocbook();
echo $docbook->save();