mirror of
https://github.com/cosmocode/dokuwiki-plugin-prosemirror.git
synced 2025-07-26 15:51:09 +00:00
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* General tests for the prosemirror plugin
|
|
*
|
|
* @group plugin_prosemirror
|
|
* @group plugins
|
|
*/
|
|
class renderer_plugin_prosemirror_test extends DokuWikiTest
|
|
{
|
|
|
|
protected $pluginsEnabled = ['prosemirror', 'wrap'];
|
|
|
|
/**
|
|
* @dataProvider rendererProvider
|
|
*
|
|
* @param string $dokuwikiMarkup
|
|
* @param string $expectedJSON
|
|
* @param string $msg
|
|
*/
|
|
public function test_renderer($dokuwikiMarkup, $expectedJSON, $msg)
|
|
{
|
|
global $ID;
|
|
$ID = 'wiki:syntax';
|
|
$instructions = p_get_instructions($dokuwikiMarkup);
|
|
$doc = p_render('prosemirror', $instructions, $info);
|
|
$this->assertJsonStringEqualsJsonString($expectedJSON, $doc, $msg);
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function rendererProvider()
|
|
{
|
|
$data = [];
|
|
|
|
$files = glob(__DIR__ . '/json/*.json');
|
|
foreach ($files as $file) {
|
|
$name = basename($file, '.json');
|
|
$json = file_get_contents(__DIR__ . '/json/' . $name . '.json');
|
|
$wiki = file_get_contents(__DIR__ . '/json/' . $name . '.txt');
|
|
$data[] = [$wiki, $json, $name];
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
}
|