xref: /dokuwiki/_test/tests/inc/parser/renderer_metadata.test.php (revision 1c33cec37215d0c964cf961bdbc49ae7db3657e6)
12ef8deb5SChristopher Smith<?php
22ef8deb5SChristopher Smith
32ef8deb5SChristopher Smith/**
42ef8deb5SChristopher Smith * Class renderer_xhtml_test
52ef8deb5SChristopher Smith */
62ef8deb5SChristopher Smithclass renderer_metadata_test extends DokuWikiTest {
72ef8deb5SChristopher Smith    /** @var Doku_Renderer_xhtml */
82ef8deb5SChristopher Smith    protected $R;
92ef8deb5SChristopher Smith
102ef8deb5SChristopher Smith    /**
112ef8deb5SChristopher Smith     * Called for each test
122ef8deb5SChristopher Smith     *
132ef8deb5SChristopher Smith     * @throws Exception
142ef8deb5SChristopher Smith     */
15*1c33cec3SAndreas Gohr    function setUp() : void {
162ef8deb5SChristopher Smith        parent::setUp();
172ef8deb5SChristopher Smith        $this->R = new Doku_Renderer_metadata();
182ef8deb5SChristopher Smith    }
192ef8deb5SChristopher Smith
20*1c33cec3SAndreas Gohr    function tearDown() : void {
212ef8deb5SChristopher Smith        unset($this->R);
222ef8deb5SChristopher Smith    }
232ef8deb5SChristopher Smith
242ef8deb5SChristopher Smith
252ef8deb5SChristopher Smith    function test_footnote_and_abstract() {
262ef8deb5SChristopher Smith        // avoid issues with the filectime() & filemtime in document_start() & document_end()
272ef8deb5SChristopher Smith        $now = time();
282ef8deb5SChristopher Smith        $this->R->persistent['date']['created'] = $now;
292ef8deb5SChristopher Smith        $this->R->persistent['date']['modified'] = $now;
302ef8deb5SChristopher Smith
312ef8deb5SChristopher Smith        $this->R->document_start();
322ef8deb5SChristopher Smith
332ef8deb5SChristopher Smith        $this->R->cdata("abstract: ");
342ef8deb5SChristopher Smith
352ef8deb5SChristopher Smith        $this->R->footnote_open();
362ef8deb5SChristopher Smith        $this->R->cdata(str_pad("footnote: ", Doku_Renderer_metadata::ABSTRACT_MAX, "lotsa junk "));
372ef8deb5SChristopher Smith        $this->R->footnote_close();
382ef8deb5SChristopher Smith
392ef8deb5SChristopher Smith        $this->R->cdata("abstract end.");
402ef8deb5SChristopher Smith
412ef8deb5SChristopher Smith        $this->R->document_end();
422ef8deb5SChristopher Smith
432ef8deb5SChristopher Smith        $expected = 'abstract: abstract end.';
442ef8deb5SChristopher Smith        $this->assertEquals($expected, $this->R->meta['description']['abstract']);
452ef8deb5SChristopher Smith    }
462ef8deb5SChristopher Smith
472ef8deb5SChristopher Smith}
48