xref: /dokuwiki/_test/tests/Parsing/ParserMode/FootnoteTest.php (revision 504c13e8df88563c11b3720b317991bc38835a35)
1*504c13e8SAndreas Gohr<?php
2*504c13e8SAndreas Gohr
3*504c13e8SAndreas Gohrnamespace dokuwiki\test\Parsing\ParserMode;
4*504c13e8SAndreas Gohr
5*504c13e8SAndreas Gohruse dokuwiki\Parsing\Handler\Lists;
6*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Code;
7*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Eol;
8*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Footnote;
9*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Strong;
10*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Hr;
11*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Listblock;
12*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Preformatted;
13*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Quote;
14*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Table;
15*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Unformatted;
16*504c13e8SAndreas Gohr
17*504c13e8SAndreas Gohrclass FootnoteTest extends ParserTestBase
18*504c13e8SAndreas Gohr{
19*504c13e8SAndreas Gohr
20*504c13e8SAndreas Gohr    function setUp() : void {
21*504c13e8SAndreas Gohr        parent::setUp();
22*504c13e8SAndreas Gohr        $this->P->addMode('footnote',new Footnote());
23*504c13e8SAndreas Gohr    }
24*504c13e8SAndreas Gohr
25*504c13e8SAndreas Gohr    function testFootnote() {
26*504c13e8SAndreas Gohr        $this->P->parse('Foo (( testing )) Bar');
27*504c13e8SAndreas Gohr        $calls = [
28*504c13e8SAndreas Gohr            ['document_start',[]],
29*504c13e8SAndreas Gohr            ['p_open',[]],
30*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
31*504c13e8SAndreas Gohr            ['nest', [ [
32*504c13e8SAndreas Gohr              ['footnote_open',[]],
33*504c13e8SAndreas Gohr              ['cdata',[' testing ']],
34*504c13e8SAndreas Gohr              ['footnote_close',[]],
35*504c13e8SAndreas Gohr            ]]],
36*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
37*504c13e8SAndreas Gohr            ['p_close',[]],
38*504c13e8SAndreas Gohr            ['document_end',[]],
39*504c13e8SAndreas Gohr        ];
40*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
41*504c13e8SAndreas Gohr    }
42*504c13e8SAndreas Gohr
43*504c13e8SAndreas Gohr    function testNotAFootnote() {
44*504c13e8SAndreas Gohr        $this->P->parse("Foo (( testing\n Bar");
45*504c13e8SAndreas Gohr        $calls = [
46*504c13e8SAndreas Gohr            ['document_start',[]],
47*504c13e8SAndreas Gohr            ['p_open',[]],
48*504c13e8SAndreas Gohr            ['cdata',["\nFoo (( testing\n Bar"]],
49*504c13e8SAndreas Gohr            ['p_close',[]],
50*504c13e8SAndreas Gohr            ['document_end',[]],
51*504c13e8SAndreas Gohr        ];
52*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
53*504c13e8SAndreas Gohr    }
54*504c13e8SAndreas Gohr
55*504c13e8SAndreas Gohr    function testFootnoteLinefeed() {
56*504c13e8SAndreas Gohr        $this->P->addMode('eol',new Eol());
57*504c13e8SAndreas Gohr        $this->P->parse("Foo (( testing\ntesting )) Bar");
58*504c13e8SAndreas Gohr        $calls = [
59*504c13e8SAndreas Gohr            ['document_start',[]],
60*504c13e8SAndreas Gohr            ['p_open',[]],
61*504c13e8SAndreas Gohr            ['cdata',['Foo ']],
62*504c13e8SAndreas Gohr            ['nest', [ [
63*504c13e8SAndreas Gohr              ['footnote_open',[]],
64*504c13e8SAndreas Gohr              ['cdata',[" testing\ntesting "]],
65*504c13e8SAndreas Gohr              ['footnote_close',[]],
66*504c13e8SAndreas Gohr            ]]],
67*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
68*504c13e8SAndreas Gohr            ['p_close',[]],
69*504c13e8SAndreas Gohr            ['document_end',[]],
70*504c13e8SAndreas Gohr        ];
71*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
72*504c13e8SAndreas Gohr    }
73*504c13e8SAndreas Gohr
74*504c13e8SAndreas Gohr    function testFootnoteNested() {
75*504c13e8SAndreas Gohr        $this->P->parse('Foo (( x((y))z )) Bar');
76*504c13e8SAndreas Gohr        $calls = [
77*504c13e8SAndreas Gohr            ['document_start',[]],
78*504c13e8SAndreas Gohr            ['p_open',[]],
79*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
80*504c13e8SAndreas Gohr            ['nest', [ [
81*504c13e8SAndreas Gohr              ['footnote_open',[]],
82*504c13e8SAndreas Gohr              ['cdata',[' x((y']],
83*504c13e8SAndreas Gohr              ['footnote_close',[]],
84*504c13e8SAndreas Gohr            ]]],
85*504c13e8SAndreas Gohr            ['cdata',['z )) Bar']],
86*504c13e8SAndreas Gohr            ['p_close',[]],
87*504c13e8SAndreas Gohr            ['document_end',[]],
88*504c13e8SAndreas Gohr        ];
89*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
90*504c13e8SAndreas Gohr    }
91*504c13e8SAndreas Gohr
92*504c13e8SAndreas Gohr    function testFootnoteEol() {
93*504c13e8SAndreas Gohr        $this->P->addMode('eol',new Eol());
94*504c13e8SAndreas Gohr        $this->P->parse("Foo \nX(( test\ning ))Y\n Bar");
95*504c13e8SAndreas Gohr        $calls = [
96*504c13e8SAndreas Gohr            ['document_start',[]],
97*504c13e8SAndreas Gohr            ['p_open',[]],
98*504c13e8SAndreas Gohr            ['cdata',['Foo '."\n".'X']],
99*504c13e8SAndreas Gohr            ['nest', [ [
100*504c13e8SAndreas Gohr              ['footnote_open',[]],
101*504c13e8SAndreas Gohr              ['cdata',[" test\ning "]],
102*504c13e8SAndreas Gohr              ['footnote_close',[]],
103*504c13e8SAndreas Gohr            ]]],
104*504c13e8SAndreas Gohr            ['cdata',['Y'."\n".' Bar']],
105*504c13e8SAndreas Gohr            ['p_close',[]],
106*504c13e8SAndreas Gohr            ['document_end',[]],
107*504c13e8SAndreas Gohr        ];
108*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
109*504c13e8SAndreas Gohr    }
110*504c13e8SAndreas Gohr
111*504c13e8SAndreas Gohr    function testFootnoteStrong() {
112*504c13e8SAndreas Gohr        $this->P->addMode('strong',new Strong());
113*504c13e8SAndreas Gohr        $this->P->parse('Foo (( **testing** )) Bar');
114*504c13e8SAndreas Gohr        $calls = [
115*504c13e8SAndreas Gohr            ['document_start',[]],
116*504c13e8SAndreas Gohr            ['p_open',[]],
117*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
118*504c13e8SAndreas Gohr            ['nest', [ [
119*504c13e8SAndreas Gohr              ['footnote_open',[]],
120*504c13e8SAndreas Gohr              ['cdata',[' ']],
121*504c13e8SAndreas Gohr              ['strong_open',[]],
122*504c13e8SAndreas Gohr              ['cdata',['testing']],
123*504c13e8SAndreas Gohr              ['strong_close',[]],
124*504c13e8SAndreas Gohr              ['cdata',[' ']],
125*504c13e8SAndreas Gohr              ['footnote_close',[]],
126*504c13e8SAndreas Gohr            ]]],
127*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
128*504c13e8SAndreas Gohr            ['p_close',[]],
129*504c13e8SAndreas Gohr            ['document_end',[]],
130*504c13e8SAndreas Gohr        ];
131*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
132*504c13e8SAndreas Gohr    }
133*504c13e8SAndreas Gohr
134*504c13e8SAndreas Gohr    function testFootnoteHr() {
135*504c13e8SAndreas Gohr        $this->P->addMode('hr',new Hr());
136*504c13e8SAndreas Gohr        $this->P->parse("Foo (( \n ---- \n )) Bar");
137*504c13e8SAndreas Gohr        $calls = [
138*504c13e8SAndreas Gohr            ['document_start',[]],
139*504c13e8SAndreas Gohr            ['p_open',[]],
140*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
141*504c13e8SAndreas Gohr            ['nest', [ [
142*504c13e8SAndreas Gohr              ['footnote_open',[]],
143*504c13e8SAndreas Gohr              ['cdata',[' ']],
144*504c13e8SAndreas Gohr              ['hr',[]],
145*504c13e8SAndreas Gohr              ['cdata',["\n "]],
146*504c13e8SAndreas Gohr              ['footnote_close',[]],
147*504c13e8SAndreas Gohr            ]]],
148*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
149*504c13e8SAndreas Gohr            ['p_close',[]],
150*504c13e8SAndreas Gohr            ['document_end',[]],
151*504c13e8SAndreas Gohr        ];
152*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
153*504c13e8SAndreas Gohr    }
154*504c13e8SAndreas Gohr
155*504c13e8SAndreas Gohr    function testFootnoteCode() {
156*504c13e8SAndreas Gohr        $this->P->addMode('code',new Code());
157*504c13e8SAndreas Gohr        $this->P->parse("Foo (( <code>Test</code> )) Bar");
158*504c13e8SAndreas Gohr        $calls = [
159*504c13e8SAndreas Gohr            ['document_start',[]],
160*504c13e8SAndreas Gohr            ['p_open',[]],
161*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
162*504c13e8SAndreas Gohr            ['nest', [ [
163*504c13e8SAndreas Gohr              ['footnote_open',[]],
164*504c13e8SAndreas Gohr              ['cdata',[' ']],
165*504c13e8SAndreas Gohr              ['code',['Test',null,null]],
166*504c13e8SAndreas Gohr              ['cdata',[' ']],
167*504c13e8SAndreas Gohr              ['footnote_close',[]],
168*504c13e8SAndreas Gohr            ]]],
169*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
170*504c13e8SAndreas Gohr            ['p_close',[]],
171*504c13e8SAndreas Gohr            ['document_end',[]],
172*504c13e8SAndreas Gohr        ];
173*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
174*504c13e8SAndreas Gohr    }
175*504c13e8SAndreas Gohr
176*504c13e8SAndreas Gohr    function testFootnotePreformatted() {
177*504c13e8SAndreas Gohr        $this->P->addMode('preformatted',new Preformatted());
178*504c13e8SAndreas Gohr        $this->P->parse("Foo (( \n  Test\n )) Bar");
179*504c13e8SAndreas Gohr        $calls = [
180*504c13e8SAndreas Gohr            ['document_start',[]],
181*504c13e8SAndreas Gohr            ['p_open',[]],
182*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
183*504c13e8SAndreas Gohr            ['nest', [ [
184*504c13e8SAndreas Gohr              ['footnote_open',[]],
185*504c13e8SAndreas Gohr              ['cdata',[' ']],
186*504c13e8SAndreas Gohr              ['preformatted',['Test']],
187*504c13e8SAndreas Gohr              ['cdata',[' ']],
188*504c13e8SAndreas Gohr              ['footnote_close',[]],
189*504c13e8SAndreas Gohr            ]]],
190*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
191*504c13e8SAndreas Gohr            ['p_close',[]],
192*504c13e8SAndreas Gohr            ['document_end',[]],
193*504c13e8SAndreas Gohr        ];
194*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
195*504c13e8SAndreas Gohr    }
196*504c13e8SAndreas Gohr
197*504c13e8SAndreas Gohr    function testFootnotePreformattedEol() {
198*504c13e8SAndreas Gohr        $this->P->addMode('preformatted',new Preformatted());
199*504c13e8SAndreas Gohr        $this->P->addMode('eol',new Eol());
200*504c13e8SAndreas Gohr        $this->P->parse("Foo (( \n  Test\n )) Bar");
201*504c13e8SAndreas Gohr        $calls = [
202*504c13e8SAndreas Gohr            ['document_start',[]],
203*504c13e8SAndreas Gohr            ['p_open',[]],
204*504c13e8SAndreas Gohr            ['cdata',['Foo ']],
205*504c13e8SAndreas Gohr            ['nest', [ [
206*504c13e8SAndreas Gohr              ['footnote_open',[]],
207*504c13e8SAndreas Gohr              ['cdata',[' ']],
208*504c13e8SAndreas Gohr              ['preformatted',['Test']],
209*504c13e8SAndreas Gohr              ['cdata',[' ']],
210*504c13e8SAndreas Gohr              ['footnote_close',[]],
211*504c13e8SAndreas Gohr            ]]],
212*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
213*504c13e8SAndreas Gohr            ['p_close',[]],
214*504c13e8SAndreas Gohr            ['document_end',[]],
215*504c13e8SAndreas Gohr        ];
216*504c13e8SAndreas Gohr
217*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
218*504c13e8SAndreas Gohr    }
219*504c13e8SAndreas Gohr
220*504c13e8SAndreas Gohr    function testFootnoteUnformatted() {
221*504c13e8SAndreas Gohr        $this->P->addMode('unformatted',new Unformatted());
222*504c13e8SAndreas Gohr        $this->P->parse("Foo (( <nowiki>Test</nowiki> )) Bar");
223*504c13e8SAndreas Gohr        $calls = [
224*504c13e8SAndreas Gohr            ['document_start',[]],
225*504c13e8SAndreas Gohr            ['p_open',[]],
226*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
227*504c13e8SAndreas Gohr            ['nest', [ [
228*504c13e8SAndreas Gohr              ['footnote_open',[]],
229*504c13e8SAndreas Gohr              ['cdata',[' ']],
230*504c13e8SAndreas Gohr              ['unformatted',['Test']],
231*504c13e8SAndreas Gohr              ['cdata',[' ']],
232*504c13e8SAndreas Gohr              ['footnote_close',[]],
233*504c13e8SAndreas Gohr            ]]],
234*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
235*504c13e8SAndreas Gohr            ['p_close',[]],
236*504c13e8SAndreas Gohr            ['document_end',[]],
237*504c13e8SAndreas Gohr        ];
238*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
239*504c13e8SAndreas Gohr    }
240*504c13e8SAndreas Gohr
241*504c13e8SAndreas Gohr    function testFootnoteNotHeader() {
242*504c13e8SAndreas Gohr        $this->P->addMode('unformatted',new Unformatted());
243*504c13e8SAndreas Gohr        $this->P->parse("Foo (( \n====Test====\n )) Bar");
244*504c13e8SAndreas Gohr        $calls = [
245*504c13e8SAndreas Gohr            ['document_start',[]],
246*504c13e8SAndreas Gohr            ['p_open',[]],
247*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
248*504c13e8SAndreas Gohr            ['nest', [ [
249*504c13e8SAndreas Gohr              ['footnote_open',[]],
250*504c13e8SAndreas Gohr              ['cdata',[" \n====Test====\n "]],
251*504c13e8SAndreas Gohr              ['footnote_close',[]],
252*504c13e8SAndreas Gohr            ]]],
253*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
254*504c13e8SAndreas Gohr            ['p_close',[]],
255*504c13e8SAndreas Gohr            ['document_end',[]],
256*504c13e8SAndreas Gohr        ];
257*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
258*504c13e8SAndreas Gohr    }
259*504c13e8SAndreas Gohr
260*504c13e8SAndreas Gohr    function testFootnoteTable() {
261*504c13e8SAndreas Gohr        $this->P->addMode('table',new Table());
262*504c13e8SAndreas Gohr        $this->P->parse("Foo ((
263*504c13e8SAndreas Gohr| Row 0 Col 1    | Row 0 Col 2     | Row 0 Col 3        |
264*504c13e8SAndreas Gohr| Row 1 Col 1    | Row 1 Col 2     | Row 1 Col 3        |
265*504c13e8SAndreas Gohr )) Bar");
266*504c13e8SAndreas Gohr        $calls = [
267*504c13e8SAndreas Gohr            ['document_start',[]],
268*504c13e8SAndreas Gohr            ['p_open',[]],
269*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
270*504c13e8SAndreas Gohr            ['nest', [ [
271*504c13e8SAndreas Gohr              ['footnote_open',[]],
272*504c13e8SAndreas Gohr              ['table_open',[3, 2, 8]],
273*504c13e8SAndreas Gohr              ['tablerow_open',[]],
274*504c13e8SAndreas Gohr              ['tablecell_open',[1,'left',1]],
275*504c13e8SAndreas Gohr              ['cdata',[' Row 0 Col 1    ']],
276*504c13e8SAndreas Gohr              ['tablecell_close',[]],
277*504c13e8SAndreas Gohr              ['tablecell_open',[1,'left',1]],
278*504c13e8SAndreas Gohr              ['cdata',[' Row 0 Col 2     ']],
279*504c13e8SAndreas Gohr              ['tablecell_close',[]],
280*504c13e8SAndreas Gohr              ['tablecell_open',[1,'left',1]],
281*504c13e8SAndreas Gohr              ['cdata',[' Row 0 Col 3        ']],
282*504c13e8SAndreas Gohr              ['tablecell_close',[]],
283*504c13e8SAndreas Gohr              ['tablerow_close',[]],
284*504c13e8SAndreas Gohr              ['tablerow_open',[]],
285*504c13e8SAndreas Gohr              ['tablecell_open',[1,'left',1]],
286*504c13e8SAndreas Gohr              ['cdata',[' Row 1 Col 1    ']],
287*504c13e8SAndreas Gohr              ['tablecell_close',[]],
288*504c13e8SAndreas Gohr              ['tablecell_open',[1,'left',1]],
289*504c13e8SAndreas Gohr              ['cdata',[' Row 1 Col 2     ']],
290*504c13e8SAndreas Gohr              ['tablecell_close',[]],
291*504c13e8SAndreas Gohr              ['tablecell_open',[1,'left',1]],
292*504c13e8SAndreas Gohr              ['cdata',[' Row 1 Col 3        ']],
293*504c13e8SAndreas Gohr              ['tablecell_close',[]],
294*504c13e8SAndreas Gohr              ['tablerow_close',[]],
295*504c13e8SAndreas Gohr              ['table_close',[123]],
296*504c13e8SAndreas Gohr              ['cdata',[' ']],
297*504c13e8SAndreas Gohr              ['footnote_close',[]],
298*504c13e8SAndreas Gohr            ]]],
299*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
300*504c13e8SAndreas Gohr            ['p_close',[]],
301*504c13e8SAndreas Gohr            ['document_end',[]],
302*504c13e8SAndreas Gohr        ];
303*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
304*504c13e8SAndreas Gohr    }
305*504c13e8SAndreas Gohr
306*504c13e8SAndreas Gohr    function testFootnoteList() {
307*504c13e8SAndreas Gohr        $this->P->addMode('listblock',new ListBlock());
308*504c13e8SAndreas Gohr        $this->P->parse("Foo ((
309*504c13e8SAndreas Gohr  *A
310*504c13e8SAndreas Gohr    * B
311*504c13e8SAndreas Gohr  * C
312*504c13e8SAndreas Gohr )) Bar");
313*504c13e8SAndreas Gohr        $calls = [
314*504c13e8SAndreas Gohr            ['document_start',[]],
315*504c13e8SAndreas Gohr            ['p_open',[]],
316*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
317*504c13e8SAndreas Gohr            ['nest', [ [
318*504c13e8SAndreas Gohr              ['footnote_open',[]],
319*504c13e8SAndreas Gohr              ['listu_open',[]],
320*504c13e8SAndreas Gohr              ['listitem_open',[1,Lists::NODE]],
321*504c13e8SAndreas Gohr              ['listcontent_open',[]],
322*504c13e8SAndreas Gohr              ['cdata',["A"]],
323*504c13e8SAndreas Gohr              ['listcontent_close',[]],
324*504c13e8SAndreas Gohr              ['listu_open',[]],
325*504c13e8SAndreas Gohr              ['listitem_open',[2]],
326*504c13e8SAndreas Gohr              ['listcontent_open',[]],
327*504c13e8SAndreas Gohr              ['cdata',[' B']],
328*504c13e8SAndreas Gohr              ['listcontent_close',[]],
329*504c13e8SAndreas Gohr              ['listitem_close',[]],
330*504c13e8SAndreas Gohr              ['listu_close',[]],
331*504c13e8SAndreas Gohr              ['listitem_close',[]],
332*504c13e8SAndreas Gohr              ['listitem_open',[1]],
333*504c13e8SAndreas Gohr              ['listcontent_open',[]],
334*504c13e8SAndreas Gohr              ['cdata',[' C']],
335*504c13e8SAndreas Gohr              ['listcontent_close',[]],
336*504c13e8SAndreas Gohr              ['listitem_close',[]],
337*504c13e8SAndreas Gohr              ['listu_close',[]],
338*504c13e8SAndreas Gohr              ['cdata',[' ']],
339*504c13e8SAndreas Gohr              ['footnote_close',[]],
340*504c13e8SAndreas Gohr            ]]],
341*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
342*504c13e8SAndreas Gohr            ['p_close',[]],
343*504c13e8SAndreas Gohr            ['document_end',[]],
344*504c13e8SAndreas Gohr        ];
345*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
346*504c13e8SAndreas Gohr    }
347*504c13e8SAndreas Gohr
348*504c13e8SAndreas Gohr    function testFootnoteQuote() {
349*504c13e8SAndreas Gohr        $this->P->addMode('quote',new Quote());
350*504c13e8SAndreas Gohr        $this->P->parse("Foo ((
351*504c13e8SAndreas Gohr> def
352*504c13e8SAndreas Gohr>>ghi
353*504c13e8SAndreas Gohr )) Bar");
354*504c13e8SAndreas Gohr        $calls = [
355*504c13e8SAndreas Gohr            ['document_start',[]],
356*504c13e8SAndreas Gohr            ['p_open',[]],
357*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
358*504c13e8SAndreas Gohr            ['nest', [ [
359*504c13e8SAndreas Gohr              ['footnote_open',[]],
360*504c13e8SAndreas Gohr              ['quote_open',[]],
361*504c13e8SAndreas Gohr              ['cdata',[" def"]],
362*504c13e8SAndreas Gohr              ['quote_open',[]],
363*504c13e8SAndreas Gohr              ['cdata',["ghi"]],
364*504c13e8SAndreas Gohr              ['quote_close',[]],
365*504c13e8SAndreas Gohr              ['quote_close',[]],
366*504c13e8SAndreas Gohr              ['cdata',[' ']],
367*504c13e8SAndreas Gohr              ['footnote_close',[]],
368*504c13e8SAndreas Gohr            ]]],
369*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
370*504c13e8SAndreas Gohr            ['p_close',[]],
371*504c13e8SAndreas Gohr            ['document_end',[]],
372*504c13e8SAndreas Gohr        ];
373*504c13e8SAndreas Gohr
374*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
375*504c13e8SAndreas Gohr    }
376*504c13e8SAndreas Gohr
377*504c13e8SAndreas Gohr    function testFootnoteNesting() {
378*504c13e8SAndreas Gohr        $this->P->addMode('strong',new Strong());
379*504c13e8SAndreas Gohr        $this->P->parse("(( a ** (( b )) ** c ))");
380*504c13e8SAndreas Gohr
381*504c13e8SAndreas Gohr        $calls = [
382*504c13e8SAndreas Gohr            ['document_start',[]],
383*504c13e8SAndreas Gohr            ['p_open',[]],
384*504c13e8SAndreas Gohr            ['cdata',["\n"]],
385*504c13e8SAndreas Gohr            ['nest', [ [
386*504c13e8SAndreas Gohr              ['footnote_open',[]],
387*504c13e8SAndreas Gohr              ['cdata',[' a ']],
388*504c13e8SAndreas Gohr              ['strong_open',[]],
389*504c13e8SAndreas Gohr              ['cdata',[' (( b ']],
390*504c13e8SAndreas Gohr              ['footnote_close',[]],
391*504c13e8SAndreas Gohr            ]]],
392*504c13e8SAndreas Gohr            ['cdata',[" "]],
393*504c13e8SAndreas Gohr            ['strong_close',[]],
394*504c13e8SAndreas Gohr            ['cdata',[" c ))"]],
395*504c13e8SAndreas Gohr            ['p_close',[]],
396*504c13e8SAndreas Gohr            ['document_end',[]],
397*504c13e8SAndreas Gohr        ];
398*504c13e8SAndreas Gohr
399*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
400*504c13e8SAndreas Gohr    }
401*504c13e8SAndreas Gohr}
402