1<?php
2
3/**
4 * Class renderer_xhtml_test
5 */
6class renderer_metadata_test extends DokuWikiTest {
7    /** @var Doku_Renderer_xhtml */
8    protected $R;
9
10    /**
11     * Called for each test
12     *
13     * @throws Exception
14     */
15    function setUp() : void {
16        parent::setUp();
17        $this->R = new Doku_Renderer_metadata();
18    }
19
20    function tearDown() : void {
21        unset($this->R);
22    }
23
24
25    function test_footnote_and_abstract() {
26        // avoid issues with the filectime() & filemtime in document_start() & document_end()
27        $now = time();
28        $this->R->persistent['date']['created'] = $now;
29        $this->R->persistent['date']['modified'] = $now;
30
31        $this->R->document_start();
32
33        $this->R->cdata("abstract: ");
34
35        $this->R->footnote_open();
36        $this->R->cdata(str_pad("footnote: ", Doku_Renderer_metadata::ABSTRACT_MAX, "lotsa junk "));
37        $this->R->footnote_close();
38
39        $this->R->cdata("abstract end.");
40
41        $this->R->document_end();
42
43        $expected = 'abstract: abstract end.';
44        $this->assertEquals($expected, $this->R->meta['description']['abstract']);
45    }
46
47}
48