1<?php
2
3
4/**
5 * Test the template
6 *
7 * @group template_bootie
8 * @group templates
9 */
10class plugin_webcomponent_header_test extends DokuWikiTest
11{
12
13
14
15
16    public function test_base()
17    {
18
19        global $conf;
20        // https://www.dokuwiki.org/config:jquerycdn
21        $conf ['jquerycdn'] = 'cdnjs';
22
23        // https://getbootstrap.com/docs/4.3/components/card/#using-custom-css
24        $elements = syntax_plugin_webcomponent_button::getTags();
25        $link_content = 'Go Somewhere';
26        $doku_text = '<' . $elements[0] . '>' . '[[:namespace:page#section|' . $link_content . ']]' . '</' . $elements[0] . '>';
27        $pageId = syntax_plugin_webcomponent_button::getTag().':header:test_base';
28        saveWikiText($pageId, $doku_text, 'Header Test base');
29        idx_addPage($pageId);
30
31        $request = new TestRequest();
32        $response = $request->get(array('id' => $pageId, '/doku.php'));
33        $expected = '<a href="/doku.php?id=:namespace:page%23section" class="btn btn-primary">' . $link_content . '</a>';
34
35        $generator = $response->queryHTML('meta[name="generator"]');
36        $this->assertEquals($expected, $generator);
37
38
39    }
40
41
42}
43