Commit fe0e6b34 authored by Andreas Gohr's avatar Andreas Gohr

added current state of instruction creation

this is a passing test that probably should not pass.
parent 171b7e37
<?php
/**
* General tests for the ifauthex plugin
*
* @group plugin_ifauthex
* @group plugins
*/
class instructions_plugin_ifauthex_test extends DokuWikiTest
{
protected $pluginsEnabled = array('ifauthex');
public function test_instructions()
{
$calls = p_get_instructions(file_get_contents(__DIR__.'/testpage.txt'));
$calls = array_map([self::class, 'stripByteIndex'], $calls);
$this->assertEquals(json_decode(file_get_contents(__DIR__.'/testpage.json')), $calls);
//print_r($calls);
}
/**
* copied from the core test suite, removes the byte positions
*
* @param $call
* @return mixed
*/
public static function stripByteIndex($call) {
unset($call[2]);
if ($call[0] == "nest") {
$call[1][0] = array_map('stripByteIndex',$call[1][0]);
}
return $call;
}
}
[
["document_start", []],
["header", ["Sec 1", 3, 1]],
["section_open", [3]],
["p_open", []],
["cdata", ["1abc"]],
["p_close", []],
["plugin", ["ifauthex", [1, " admin"], 1, "<ifauth admin>"]],
["header", ["Sec 2", 3, 40]],
["p_open", []],
["plugin", ["ifauthex_closesection", [], 5, ""]],
["p_close", []],
["p_open", []],
["plugin", ["ifauthex", [3, "2def"], 3, "2def"]],
["p_close", []],
["plugin", ["ifauthex", [4, null], 4, "<\/ifauth>"]],
["section_close", []],
["header", ["Sec 3", 3, 74]],
["section_open", [3]],
["p_open", []],
["cdata", ["3ghi"]],
["p_close", []],
["plugin", ["ifauthex", [1, " admina"], 1, "<ifauth admina>"]],
["header", ["Sec 4", 3, 114]],
["p_open", []],
["plugin", ["ifauthex_closesection", [], 5, ""]],
["p_close", []],
["p_open", []],
["plugin", ["ifauthex", [3, "4jkl"], 3, "4jkl"]],
["p_close", []],
["plugin", ["ifauthex", [4, null], 4, "<\/ifauth>"]],
["section_close", []],
["header", ["Sec 5", 3, 148]],
["section_open", [3]],
["p_open", []],
["cdata", ["5mno"]],
["p_close", []],
["section_close", []],
["document_end", []]
]
==== Sec 1 ====
1abc
<ifauth admin>
==== Sec 2 ====
2def
</ifauth>
==== Sec 3 ====
3ghi
<ifauth admina>
==== Sec 4 ====
4jkl
</ifauth>
==== Sec 5 ====
5mno
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment