]> Raphaƫl G. Git Repositories - bbcode/blob - tests/002.phpt
b9d101a6d84d299581a2f417a39e232eb14a9c85
[bbcode] / tests / 002.phpt
1 --TEST--
2 Check for bbcode functions
3 --SKIPIF--
4 <?php if (!extension_loaded("bbcode")) print "skip"; ?>
5 --FILE--
6 <?php
7 $obj = new bbcode(
8 [
9 'img' => [
10 ],
11 '' => [
12 'type' => BBCODE::TYPE_ROOT,
13 'child' => ['ul','url','img','b','i']
14 ],
15 'i' => [
16 'type' => BBCODE::TYPE_MULTI
17 //TODO: by default open tag = <KEY> and close tag = </KEY>
18 ],
19 'b' => [
20 'type' => BBCODE::TYPE_MULTI
21 ],
22 'ul' => [
23 'type' => BBCODE::TYPE_MULTI,
24 'child' => ['li']
25 ],
26 'li' => [
27 'type' => BBCODE::TYPE_MULTI,
28 'parent' => ['ul'],
29 'child' => ['url','img','b','i']
30 ],
31 'url' => [
32 'type' => BBCODE::TYPE_MULTI,
33 'parent' => ['','li','b','i'],
34 'open' => '<a%s>',
35 'close' => '</a>',
36 'arg' => 'href'
37 ],
38 ],
39 [
40 ':)' => '<img src="smiley.gif" alt=":)" />',
41 ':(' => '<img src="sad.gif" alt=":(" />',
42 ':D' => '<img src="happy.gif" alt=":D" />',
43 ':p' => '<img src="tong.gif" alt=":p" />',
44 ':|' => '<img src="special.gif" alt=":|" />',
45 ':6:' => '<img src="six.gif" alt=":6:" />'
46 ],
47 BBCODE::REMOVE_EMPTY
48 );
49 echo $obj->parse('[ul][li][url=https://rapsys.eu]Rapsys[/url][/li][li][url=https://google.fr]Google[/url][/li][/ul]');
50 /*
51 you can add regression tests for your extension here
52
53 the output of your test code has to be equal to the
54 text in the --EXPECT-- section below for the tests
55 to pass, differences between the output and the
56 expected text are interpreted as failure
57
58 see php7/README.TESTING for further information on
59 writing regression tests
60 */
61 ?>
62 --EXPECT--
63 [ul][li][url=https://rapsys.eu]Rapsys[/url][/li][li][url=https://google.fr]Google[/url][/li][/ul]