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