-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path003-advanced-set-render.phpt
executable file
·58 lines (52 loc) · 1.28 KB
/
003-advanced-set-render.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--TEST--
Check for Sundown\Markdown::setRender
--SKIPIF--
<?php if (!extension_loaded("sundown")) print "skip"; ?>
--FILE--
<?php
$render = new Sundown\Render\HTML_TOC();
$data = <<<EOH
# Hello World
lorem ipsum dolar sit amet
## the World, What a beautiful it is.
lorem ipsum dolar sit amet
EOH;
$md = new Sundown\Markdown($render);
echo "TOC_DATA\n";
echo $md->render($data);
echo "DATA\n";
$md->setRender(new Sundown\Render\HTML(array("with_toc_data"=>true)));
echo $md->render($data);
$render = new Sundown\Render\HTML(array("with_toc_data"=>true));
$md->setRender($render);
echo $md->render($data);
$md->setRender(new Sundown\Render\HTML(array("with_toc_data"=>true)));
echo "#check render was not destroyed\n";
if($render instanceof Sundown\Render\HTML) {
echo "OK";
} else {
echo "FAILURE";
}
--EXPECT--
TOC_DATA
<ul>
<li>
<a href="#toc_0">Hello World</a>
<ul>
<li>
<a href="#toc_1">the World, What a beautiful it is.</a>
</li>
</ul>
</li>
</ul>
DATA
<h1 id="toc_0">Hello World</h1>
<p>lorem ipsum dolar sit amet</p>
<h2 id="toc_1">the World, What a beautiful it is.</h2>
<p>lorem ipsum dolar sit amet</p>
<h1 id="toc_0">Hello World</h1>
<p>lorem ipsum dolar sit amet</p>
<h2 id="toc_1">the World, What a beautiful it is.</h2>
<p>lorem ipsum dolar sit amet</p>
#check render was not destroyed
OK