xref: /dokuwiki/_test/tests/inc/template_tpl_get_action.php (revision 1c33cec37215d0c964cf961bdbc49ae7db3657e6)
148555a30SAndreas Gohr<?php
248555a30SAndreas Gohr
348555a30SAndreas Gohrclass template_tpl_get_action_test extends DokuWikiTest {
448555a30SAndreas Gohr
5*1c33cec3SAndreas Gohr    public function setUp() : void {
648555a30SAndreas Gohr        parent::setUp();
748555a30SAndreas Gohr        global $ID;
848555a30SAndreas Gohr        $ID = 'start'; // run all tests on the start page
948555a30SAndreas Gohr
1048555a30SAndreas Gohr    }
1148555a30SAndreas Gohr
1248555a30SAndreas Gohr    public function test_edit_edit() {
1348555a30SAndreas Gohr        global $ACT;
1448555a30SAndreas Gohr        global $INFO;
1548555a30SAndreas Gohr        global $REV;
1648555a30SAndreas Gohr
1748555a30SAndreas Gohr        $ACT = 'show';
1848555a30SAndreas Gohr        $REV = '';
1948555a30SAndreas Gohr        $INFO['writable'] = true;
2048555a30SAndreas Gohr        $INFO['exists'] = true;
2148555a30SAndreas Gohr        $INFO['draft'] = '';
2248555a30SAndreas Gohr
2348555a30SAndreas Gohr        $expect = array(
2448555a30SAndreas Gohr            'accesskey' => 'e',
2548555a30SAndreas Gohr            'type' => 'edit',
2648555a30SAndreas Gohr            'id' => 'start',
2748555a30SAndreas Gohr            'method' => 'post',
2848555a30SAndreas Gohr            'params' => array(
2948555a30SAndreas Gohr                'do' => 'edit',
3048555a30SAndreas Gohr                'rev' => '',
3148555a30SAndreas Gohr            ),
3248555a30SAndreas Gohr            'nofollow' => true,
3348555a30SAndreas Gohr            'replacement' => '',
3448555a30SAndreas Gohr        );
3548555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('edit'));
3648555a30SAndreas Gohr    }
3748555a30SAndreas Gohr
3848555a30SAndreas Gohr    public function test_edit_edit_rev() {
3948555a30SAndreas Gohr        global $ACT;
4048555a30SAndreas Gohr        global $INFO;
4148555a30SAndreas Gohr        global $REV;
4248555a30SAndreas Gohr
4348555a30SAndreas Gohr        $ACT = 'show';
4448555a30SAndreas Gohr        $REV = '1234';
4548555a30SAndreas Gohr        $INFO['writable'] = true;
4648555a30SAndreas Gohr        $INFO['exists'] = true;
4748555a30SAndreas Gohr        $INFO['draft'] = '';
4848555a30SAndreas Gohr
4948555a30SAndreas Gohr        $expect = array(
5048555a30SAndreas Gohr            'accesskey' => 'e',
5148555a30SAndreas Gohr            'type' => 'edit',
5248555a30SAndreas Gohr            'id' => 'start',
5348555a30SAndreas Gohr            'method' => 'post',
5448555a30SAndreas Gohr            'params' => array(
5548555a30SAndreas Gohr                'do' => 'edit',
5648555a30SAndreas Gohr                'rev' => '1234',
5748555a30SAndreas Gohr            ),
5848555a30SAndreas Gohr            'nofollow' => true,
5948555a30SAndreas Gohr            'replacement' => '',
6048555a30SAndreas Gohr        );
6148555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('edit'));
6248555a30SAndreas Gohr    }
6348555a30SAndreas Gohr
6448555a30SAndreas Gohr    public function test_edit_create() {
6548555a30SAndreas Gohr        global $ACT;
6648555a30SAndreas Gohr        global $INFO;
6748555a30SAndreas Gohr        global $REV;
6848555a30SAndreas Gohr
6948555a30SAndreas Gohr        $ACT = 'show';
7048555a30SAndreas Gohr        $REV = '';
7148555a30SAndreas Gohr        $INFO['writable'] = true;
7248555a30SAndreas Gohr        $INFO['exists'] = false;
7348555a30SAndreas Gohr        $INFO['draft'] = '';
7448555a30SAndreas Gohr
7548555a30SAndreas Gohr        $expect = array(
7648555a30SAndreas Gohr            'accesskey' => 'e',
7748555a30SAndreas Gohr            'type' => 'create',
7848555a30SAndreas Gohr            'id' => 'start',
7948555a30SAndreas Gohr            'method' => 'post',
8048555a30SAndreas Gohr            'params' => array(
8148555a30SAndreas Gohr                'do' => 'edit',
8248555a30SAndreas Gohr                'rev' => '',
8348555a30SAndreas Gohr            ),
8448555a30SAndreas Gohr            'nofollow' => true,
8548555a30SAndreas Gohr            'replacement' => '',
8648555a30SAndreas Gohr        );
8748555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('edit'));
8848555a30SAndreas Gohr    }
8948555a30SAndreas Gohr
9048555a30SAndreas Gohr    public function test_edit_draft() {
9148555a30SAndreas Gohr        global $ACT;
9248555a30SAndreas Gohr        global $INFO;
9348555a30SAndreas Gohr        global $REV;
9448555a30SAndreas Gohr
9548555a30SAndreas Gohr        $ACT = 'show';
9648555a30SAndreas Gohr        $REV = '';
9748555a30SAndreas Gohr        $INFO['writable'] = true;
9848555a30SAndreas Gohr        $INFO['exists'] = true;
9948555a30SAndreas Gohr        $INFO['draft'] = 'foobar';
10048555a30SAndreas Gohr
10148555a30SAndreas Gohr        $expect = array(
10248555a30SAndreas Gohr            'accesskey' => 'e',
10348555a30SAndreas Gohr            'type' => 'draft',
10448555a30SAndreas Gohr            'id' => 'start',
10548555a30SAndreas Gohr            'method' => 'post',
10648555a30SAndreas Gohr            'params' => array(
10748555a30SAndreas Gohr                'do' => 'draft',
10848555a30SAndreas Gohr            ),
10948555a30SAndreas Gohr            'nofollow' => true,
11048555a30SAndreas Gohr            'replacement' => '',
11148555a30SAndreas Gohr        );
11248555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('edit'));
11348555a30SAndreas Gohr    }
11448555a30SAndreas Gohr
11548555a30SAndreas Gohr    public function test_edit_show() {
11648555a30SAndreas Gohr        global $ACT;
11748555a30SAndreas Gohr        global $INFO;
11848555a30SAndreas Gohr        global $REV;
11948555a30SAndreas Gohr
12048555a30SAndreas Gohr        $ACT = 'edit';
12148555a30SAndreas Gohr        $REV = '';
12248555a30SAndreas Gohr        $INFO['writable'] = true;
12348555a30SAndreas Gohr        $INFO['exists'] = true;
12448555a30SAndreas Gohr        $INFO['draft'] = '';
12548555a30SAndreas Gohr
12648555a30SAndreas Gohr        $expect = array(
12748555a30SAndreas Gohr            'accesskey' => 'v',
12848555a30SAndreas Gohr            'type' => 'show',
12948555a30SAndreas Gohr            'id' => 'start',
13048555a30SAndreas Gohr            'method' => 'get',
13148555a30SAndreas Gohr            'params' => array(
13248555a30SAndreas Gohr                'do' => '',
13348555a30SAndreas Gohr            ),
13448555a30SAndreas Gohr            'nofollow' => true,
13548555a30SAndreas Gohr            'replacement' => '',
13648555a30SAndreas Gohr        );
13748555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('edit'));
13848555a30SAndreas Gohr    }
13948555a30SAndreas Gohr
14048555a30SAndreas Gohr    public function test_revisions() {
14148555a30SAndreas Gohr        $expect = array(
14248555a30SAndreas Gohr            'accesskey' => 'o',
14348555a30SAndreas Gohr            'type' => 'revs',
14448555a30SAndreas Gohr            'id' => 'start',
14548555a30SAndreas Gohr            'method' => 'get',
14648555a30SAndreas Gohr            'params' => array(
14748555a30SAndreas Gohr                'do' => 'revisions',
14848555a30SAndreas Gohr            ),
14948555a30SAndreas Gohr            'nofollow' => true,
15048555a30SAndreas Gohr            'replacement' => '',
15148555a30SAndreas Gohr        );
15248555a30SAndreas Gohr
15348555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('history'));
15448555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('revisions'));
15548555a30SAndreas Gohr    }
15648555a30SAndreas Gohr
15748555a30SAndreas Gohr    public function test_recent() {
15848555a30SAndreas Gohr        $expect = array(
15948555a30SAndreas Gohr            'accesskey' => 'r',
16048555a30SAndreas Gohr            'type' => 'recent',
16148555a30SAndreas Gohr            'id' => 'start',
16248555a30SAndreas Gohr            'method' => 'get',
16348555a30SAndreas Gohr            'params' => array(
16448555a30SAndreas Gohr                'do' => 'recent',
16548555a30SAndreas Gohr            ),
16648555a30SAndreas Gohr            'nofollow' => true,
16748555a30SAndreas Gohr            'replacement' => '',
16848555a30SAndreas Gohr
16948555a30SAndreas Gohr        );
17048555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('recent'));
17148555a30SAndreas Gohr    }
17248555a30SAndreas Gohr
17348555a30SAndreas Gohr    public function test_login() {
17448555a30SAndreas Gohr        $expect = array(
17548555a30SAndreas Gohr            'accesskey' => null,
17648555a30SAndreas Gohr            'type' => 'login',
17748555a30SAndreas Gohr            'id' => 'start',
17848555a30SAndreas Gohr            'method' => 'get',
17948555a30SAndreas Gohr            'params' => array(
18048555a30SAndreas Gohr                'do' => 'login',
18148555a30SAndreas Gohr                'sectok' => '',
18248555a30SAndreas Gohr            ),
18348555a30SAndreas Gohr            'nofollow' => true,
18448555a30SAndreas Gohr            'replacement' => '',
18548555a30SAndreas Gohr        );
18648555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('login'));
18748555a30SAndreas Gohr
18848555a30SAndreas Gohr        $_SERVER['REMOTE_USER'] = 'someone'; // logged in user
18948555a30SAndreas Gohr
19048555a30SAndreas Gohr        $expect = array(
19148555a30SAndreas Gohr            'accesskey' => null,
19248555a30SAndreas Gohr            'type' => 'logout',
19348555a30SAndreas Gohr            'id' => 'start',
19448555a30SAndreas Gohr            'method' => 'get',
19548555a30SAndreas Gohr            'params' => array(
19648555a30SAndreas Gohr                'do' => 'logout',
19748555a30SAndreas Gohr                'sectok' => getSecurityToken(),
19848555a30SAndreas Gohr            ),
19948555a30SAndreas Gohr            'nofollow' => true,
20048555a30SAndreas Gohr            'replacement' => '',
20148555a30SAndreas Gohr        );
20248555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('login'));
20348555a30SAndreas Gohr    }
20448555a30SAndreas Gohr
20548555a30SAndreas Gohr    public function test_profile() {
20648555a30SAndreas Gohr        $expect = false;
20748555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('profile'));
20848555a30SAndreas Gohr
20948555a30SAndreas Gohr        $_SERVER['REMOTE_USER'] = 'someone'; // logged in user
21048555a30SAndreas Gohr
21148555a30SAndreas Gohr        $expect = array(
21248555a30SAndreas Gohr            'accesskey' => null,
21348555a30SAndreas Gohr            'type' => 'profile',
21448555a30SAndreas Gohr            'id' => 'start',
21548555a30SAndreas Gohr            'method' => 'get',
21648555a30SAndreas Gohr            'params' => array(
21748555a30SAndreas Gohr                'do' => 'profile',
21848555a30SAndreas Gohr            ),
21948555a30SAndreas Gohr            'nofollow' => true,
22048555a30SAndreas Gohr            'replacement' => '',
22148555a30SAndreas Gohr        );
22248555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('profile'));
22348555a30SAndreas Gohr    }
22448555a30SAndreas Gohr
22548555a30SAndreas Gohr    public function test_index() {
22648555a30SAndreas Gohr        $expect = array(
22748555a30SAndreas Gohr            'accesskey' => 'x',
22848555a30SAndreas Gohr            'type' => 'index',
22948555a30SAndreas Gohr            'id' => 'start',
23048555a30SAndreas Gohr            'method' => 'get',
23148555a30SAndreas Gohr            'params' => array(
23248555a30SAndreas Gohr                'do' => 'index',
23348555a30SAndreas Gohr            ),
23448555a30SAndreas Gohr            'nofollow' => false,
23548555a30SAndreas Gohr            'replacement' => '',
23648555a30SAndreas Gohr        );
23748555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('index'));
23848555a30SAndreas Gohr
23948555a30SAndreas Gohr        global $ID;
24048555a30SAndreas Gohr        $ID = 'wiki:syntax';  // change to different page
24148555a30SAndreas Gohr
24248555a30SAndreas Gohr        $expect = array(
24348555a30SAndreas Gohr            'accesskey' => 'x',
24448555a30SAndreas Gohr            'type' => 'index',
24548555a30SAndreas Gohr            'id' => 'wiki:syntax',
24648555a30SAndreas Gohr            'method' => 'get',
24748555a30SAndreas Gohr            'params' => array(
24848555a30SAndreas Gohr                'do' => 'index',
24948555a30SAndreas Gohr            ),
25048555a30SAndreas Gohr            'nofollow' => true,
25148555a30SAndreas Gohr            'replacement' => '',
25248555a30SAndreas Gohr        );
25348555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('index'));
25448555a30SAndreas Gohr    }
25548555a30SAndreas Gohr
25648555a30SAndreas Gohr    public function test_admin() {
25748555a30SAndreas Gohr        $expect = false;
25848555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('admin'));
25948555a30SAndreas Gohr
26048555a30SAndreas Gohr        // logged in super user
26148555a30SAndreas Gohr        global $INFO;
26248555a30SAndreas Gohr        $_SERVER['REMOTE_USER'] = 'testuser';
26348555a30SAndreas Gohr        $INFO['ismanager'] = true;
26448555a30SAndreas Gohr
26548555a30SAndreas Gohr        $expect = array(
26648555a30SAndreas Gohr            'accesskey' => null,
26748555a30SAndreas Gohr            'type' => 'admin',
26848555a30SAndreas Gohr            'id' => 'start',
26948555a30SAndreas Gohr            'method' => 'get',
27048555a30SAndreas Gohr            'params' => array(
27148555a30SAndreas Gohr                'do' => 'admin',
27248555a30SAndreas Gohr            ),
27348555a30SAndreas Gohr            'nofollow' => true,
27448555a30SAndreas Gohr            'replacement' => '',
27548555a30SAndreas Gohr        );
27648555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('admin'));
27748555a30SAndreas Gohr    }
27848555a30SAndreas Gohr
27948555a30SAndreas Gohr    public function test_top() {
28048555a30SAndreas Gohr        $expect = array(
28148555a30SAndreas Gohr            'accesskey' => 't',
28248555a30SAndreas Gohr            'type' => 'top',
28348555a30SAndreas Gohr            'id' => '#dokuwiki__top',
28448555a30SAndreas Gohr            'method' => 'get',
28548555a30SAndreas Gohr            'params' => array(
28648555a30SAndreas Gohr                'do' => '',
28748555a30SAndreas Gohr            ),
28848555a30SAndreas Gohr            'nofollow' => true,
28948555a30SAndreas Gohr            'replacement' => '',
29048555a30SAndreas Gohr        );
29148555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('top'));
29248555a30SAndreas Gohr    }
29348555a30SAndreas Gohr
29448555a30SAndreas Gohr    public function test_back() {
29548555a30SAndreas Gohr        $expect = false;
29648555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('back'));
29748555a30SAndreas Gohr
29848555a30SAndreas Gohr        global $ID;
29948555a30SAndreas Gohr        $ID = 'wiki:syntax';
30048555a30SAndreas Gohr
30148555a30SAndreas Gohr        $expect = array(
30248555a30SAndreas Gohr            'accesskey' => 'b',
30348555a30SAndreas Gohr            'type' => 'back',
30448555a30SAndreas Gohr            'id' => 'wiki:start',
30548555a30SAndreas Gohr            'method' => 'get',
30648555a30SAndreas Gohr            'params' => array(
30748555a30SAndreas Gohr                'do' => '',
30848555a30SAndreas Gohr            ),
30948555a30SAndreas Gohr            'nofollow' => true,
31048555a30SAndreas Gohr            'replacement' => '',
31148555a30SAndreas Gohr        );
31248555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('back'));
31348555a30SAndreas Gohr    }
31448555a30SAndreas Gohr
31548555a30SAndreas Gohr    public function test_backlink() {
31648555a30SAndreas Gohr        $expect = array(
31748555a30SAndreas Gohr            'accesskey' => null,
31848555a30SAndreas Gohr            'type' => 'backlink',
31948555a30SAndreas Gohr            'id' => 'start',
32048555a30SAndreas Gohr            'method' => 'get',
32148555a30SAndreas Gohr            'params' => array(
32248555a30SAndreas Gohr                'do' => 'backlink',
32348555a30SAndreas Gohr            ),
32448555a30SAndreas Gohr            'nofollow' => true,
32548555a30SAndreas Gohr            'replacement' => '',
32648555a30SAndreas Gohr        );
32748555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('backlink'));
32848555a30SAndreas Gohr    }
32948555a30SAndreas Gohr
33048555a30SAndreas Gohr    public function test_subscribe() {
33148555a30SAndreas Gohr        $expect = false;
33248555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('subscribe'));
33348555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('subscription'));
33448555a30SAndreas Gohr
33548555a30SAndreas Gohr        $_SERVER['REMOTE_USER'] = 'someone'; // logged in user
33648555a30SAndreas Gohr
33748555a30SAndreas Gohr        $expect = false;
33848555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('subscribe'));
33948555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('subscription'));
34048555a30SAndreas Gohr
34148555a30SAndreas Gohr        // enable subscriptions
34248555a30SAndreas Gohr        global $conf;
34348555a30SAndreas Gohr        $conf['subscribers'] = true;
34448555a30SAndreas Gohr
34548555a30SAndreas Gohr        $expect = array(
34648555a30SAndreas Gohr            'accesskey' => null,
34748555a30SAndreas Gohr            'type' => 'subscribe',
34848555a30SAndreas Gohr            'id' => 'start',
34948555a30SAndreas Gohr            'method' => 'get',
35048555a30SAndreas Gohr            'params' => array(
35148555a30SAndreas Gohr                'do' => 'subscribe',
35248555a30SAndreas Gohr            ),
35348555a30SAndreas Gohr            'nofollow' => true,
35448555a30SAndreas Gohr            'replacement' => '',
35548555a30SAndreas Gohr        );
35648555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('subscribe'));
35748555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('subscription'));
35848555a30SAndreas Gohr    }
35948555a30SAndreas Gohr
36048555a30SAndreas Gohr    public function test_register() {
36148555a30SAndreas Gohr        $expect = array(
36248555a30SAndreas Gohr            'accesskey' => null,
36348555a30SAndreas Gohr            'type' => 'register',
36448555a30SAndreas Gohr            'id' => 'start',
36548555a30SAndreas Gohr            'method' => 'get',
36648555a30SAndreas Gohr            'params' => array(
36748555a30SAndreas Gohr                'do' => 'register',
36848555a30SAndreas Gohr            ),
36948555a30SAndreas Gohr            'nofollow' => true,
37048555a30SAndreas Gohr            'replacement' => '',
37148555a30SAndreas Gohr        );
37248555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('register'));
37348555a30SAndreas Gohr
37448555a30SAndreas Gohr        $_SERVER['REMOTE_USER'] = 'somebody'; // logged in user
37548555a30SAndreas Gohr
37648555a30SAndreas Gohr        $expect = false;
37748555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('register'));
37848555a30SAndreas Gohr    }
37948555a30SAndreas Gohr
38048555a30SAndreas Gohr    public function test_resendpwd() {
38148555a30SAndreas Gohr        $expect = array(
38248555a30SAndreas Gohr            'accesskey' => null,
38348555a30SAndreas Gohr            'type' => 'resendpwd',
38448555a30SAndreas Gohr            'id' => 'start',
38548555a30SAndreas Gohr            'method' => 'get',
38648555a30SAndreas Gohr            'params' => array(
38748555a30SAndreas Gohr                'do' => 'resendpwd',
38848555a30SAndreas Gohr            ),
38948555a30SAndreas Gohr            'nofollow' => true,
39048555a30SAndreas Gohr            'replacement' => '',
39148555a30SAndreas Gohr        );
39248555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('resendpwd'));
39348555a30SAndreas Gohr
39448555a30SAndreas Gohr        $_SERVER['REMOTE_USER'] = 'somebody'; // logged in user
39548555a30SAndreas Gohr
39648555a30SAndreas Gohr        $expect = false;
39748555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('resendpwd'));
39848555a30SAndreas Gohr    }
39948555a30SAndreas Gohr
40048555a30SAndreas Gohr    public function test_revert() {
40148555a30SAndreas Gohr        $expect = false;
40248555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('revert'));
40348555a30SAndreas Gohr
40448555a30SAndreas Gohr        global $REV;
40548555a30SAndreas Gohr        global $INFO;
40648555a30SAndreas Gohr        $REV = '1234';
40748555a30SAndreas Gohr        $INFO['writable'] = true;
40848555a30SAndreas Gohr        $INFO['ismanager'] = true;
40948555a30SAndreas Gohr
41048555a30SAndreas Gohr        $expect = array(
41148555a30SAndreas Gohr            'accesskey' => null,
41248555a30SAndreas Gohr            'type' => 'revert',
41348555a30SAndreas Gohr            'id' => 'start',
41448555a30SAndreas Gohr            'method' => 'get', // FIXME should this be post?
41548555a30SAndreas Gohr            'params' => array(
41648555a30SAndreas Gohr                'do' => 'revert',
41748555a30SAndreas Gohr                'rev' => '1234',
41848555a30SAndreas Gohr                'sectok' => '' // FIXME is this correct?
41948555a30SAndreas Gohr            ),
42048555a30SAndreas Gohr            'nofollow' => true,
42148555a30SAndreas Gohr            'replacement' => '',
42248555a30SAndreas Gohr        );
42348555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('revert'));
42448555a30SAndreas Gohr    }
42548555a30SAndreas Gohr
42648555a30SAndreas Gohr    public function test_media() {
42748555a30SAndreas Gohr        global $ID;
42848555a30SAndreas Gohr        $ID = 'wiki:syntax';
42948555a30SAndreas Gohr
43048555a30SAndreas Gohr        $expect = array(
43148555a30SAndreas Gohr            'accesskey' => null,
43248555a30SAndreas Gohr            'type' => 'media',
43348555a30SAndreas Gohr            'id' => 'wiki:syntax',
43448555a30SAndreas Gohr            'method' => 'get',
43548555a30SAndreas Gohr            'params' => array(
43648555a30SAndreas Gohr                'do' => 'media',
43748555a30SAndreas Gohr                'ns' => 'wiki'
43848555a30SAndreas Gohr            ),
43948555a30SAndreas Gohr            'nofollow' => true,
44048555a30SAndreas Gohr            'replacement' => '',
44148555a30SAndreas Gohr        );
44248555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('media'));
44348555a30SAndreas Gohr    }
44448555a30SAndreas Gohr
44548555a30SAndreas Gohr    public function test_mediaManager() {
44648555a30SAndreas Gohr        global $IMG;
44748555a30SAndreas Gohr        $IMG = 'wiki:dokuwiki.png';
44848555a30SAndreas Gohr
44948555a30SAndreas Gohr        $expect = array(
45048555a30SAndreas Gohr            'accesskey' => null,
45148555a30SAndreas Gohr            'type' => 'mediaManager',
45248555a30SAndreas Gohr            'id' => 'start',
45348555a30SAndreas Gohr            'method' => 'get',
45448555a30SAndreas Gohr            'params' => array(
45548555a30SAndreas Gohr                'do' => 'media',
45648555a30SAndreas Gohr                'ns' => 'wiki',
45748555a30SAndreas Gohr                'image' => 'wiki:dokuwiki.png'
45848555a30SAndreas Gohr            ),
45948555a30SAndreas Gohr            'nofollow' => true,
46048555a30SAndreas Gohr            'replacement' => '',
46148555a30SAndreas Gohr        );
46248555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('mediaManager'));
46348555a30SAndreas Gohr    }
46448555a30SAndreas Gohr
46548555a30SAndreas Gohr    public function test_img_backto() {
46648555a30SAndreas Gohr        $expect = array(
46748555a30SAndreas Gohr            'accesskey' => 'b',
46848555a30SAndreas Gohr            'type' => 'img_backto',
46948555a30SAndreas Gohr            'id' => 'start',
47048555a30SAndreas Gohr            'method' => 'get',
47148555a30SAndreas Gohr            'params' => array(),
47248555a30SAndreas Gohr            'nofollow' => true,
47348555a30SAndreas Gohr            'replacement' => 'start',
47448555a30SAndreas Gohr        );
47548555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('img_backto'));
47648555a30SAndreas Gohr    }
47748555a30SAndreas Gohr
47848555a30SAndreas Gohr    public function test_unknown() {
47948555a30SAndreas Gohr        $expect = '[unknown %s type]';
48048555a30SAndreas Gohr        $this->assertEquals($expect, tpl_get_action('unknown'));
48148555a30SAndreas Gohr    }
48248555a30SAndreas Gohr
48348555a30SAndreas Gohr}
484