1<?php
2/**
3 * @group plugin_abstract
4 * @group plugins
5 */
6class plugin_abstract_syntax_test extends DokuWikiTest {
7
8    public function setup() {
9        $this->pluginsEnabled[] = 'abstract';
10        parent::setup();
11    }
12
13    public function test_basic_syntax() {
14        global $INFO;
15        $INFO['id'] = 'test:plugin_abstract:syntax';
16        saveWikiText('test:plugin_abstract:syntax','<abstract>Test</abstract>','test');
17
18        $xhtml = p_wiki_xhtml('test:plugin_abstract:syntax');
19        $meta = p_get_metadata('test:plugin_abstract:syntax','description');
20
21        $doc = phpQuery::newDocument($xhtml);
22        $text = trim(pq("p",$doc)->eq(0)->text());
23
24        $this->assertEquals('Test', $text);
25        $this->assertEquals('Test', $meta['abstract']);
26    }
27
28    public function test_basic_syntax_hide() {
29        global $INFO;
30        $INFO['id'] = 'test:plugin_abstract:syntax';
31        saveWikiText('test:plugin_abstract:syntax','<abstract hide>Test</abstract>','test');
32
33        $xhtml = p_wiki_xhtml('test:plugin_abstract:syntax');
34        $meta = p_get_metadata('test:plugin_abstract:syntax','description');
35
36        $doc = phpQuery::newDocument($xhtml);
37        $text = trim(pq("p",$doc)->eq(0)->text());
38
39        $this->assertEquals('Test', $text);
40        $this->assertEquals('Test', $meta['abstract']);
41    }
42}
43