cosmocode /
dokuwiki-plugin-prosemirror
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * General tests for the prosemirror plugin |
||
| 5 | * |
||
| 6 | * @group plugin_prosemirror |
||
| 7 | * @group plugins |
||
| 8 | */ |
||
| 9 | class renderer_plugin_prosemirror_test extends DokuWikiTest |
||
| 10 | { |
||
| 11 | |||
| 12 | protected $pluginsEnabled = ['prosemirror', 'wrap']; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @dataProvider rendererProvider |
||
| 16 | * |
||
| 17 | * @param string $dokuwikiMarkup |
||
| 18 | * @param string $expectedJSON |
||
| 19 | * @param string $msg |
||
| 20 | */ |
||
| 21 | public function test_renderer($dokuwikiMarkup, $expectedJSON, $msg) |
||
| 22 | { |
||
| 23 | global $ID; |
||
| 24 | $ID = 'wiki:syntax'; |
||
| 25 | $instructions = p_get_instructions($dokuwikiMarkup); |
||
| 26 | $doc = p_render('prosemirror', $instructions, $info); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 27 | $this->assertJsonStringEqualsJsonString($expectedJSON, $doc, $msg); |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return array |
||
| 32 | */ |
||
| 33 | public function rendererProvider() |
||
| 34 | { |
||
| 35 | $data = []; |
||
| 36 | |||
| 37 | $files = glob(__DIR__ . '/json/*.json'); |
||
| 38 | foreach ($files as $file) { |
||
| 39 | $name = basename($file, '.json'); |
||
| 40 | $json = file_get_contents(__DIR__ . '/json/' . $name . '.json'); |
||
| 41 | $wiki = file_get_contents(__DIR__ . '/json/' . $name . '.txt'); |
||
| 42 | $data[] = [$wiki, $json, $name]; |
||
| 43 | } |
||
| 44 | |||
| 45 | return $data; |
||
| 46 | } |
||
| 47 | } |
||
| 48 |