1<?php
2
3/**
4 * General tests for the ifauthex plugin
5 *
6 * @group plugin_ifauthex
7 * @group plugins
8 */
9class instructions_plugin_ifauthex_test extends DokuWikiTest
10{
11
12    protected $pluginsEnabled = array('ifauthex');
13
14
15
16    public function test_instructions()
17    {
18
19        $calls = p_get_instructions(file_get_contents(__DIR__.'/testpage.txt'));
20
21        $calls = array_map([self::class, 'stripByteIndex'], $calls);
22
23        $this->assertJsonStringEqualsJsonFile(__DIR__.'/testpage.json', json_encode($calls));
24
25        //print_r($calls);
26    }
27
28    /**
29     * copied from the core test suite, removes the byte positions
30     *
31     * @param $call
32     * @return mixed
33     */
34    public static function stripByteIndex($call) {
35        unset($call[2]);
36        if ($call[0] == "nest") {
37            $call[1][0] = array_map('stripByteIndex',$call[1][0]);
38        }
39        return $call;
40    }
41}
42