Move bottomscripts down to just above the </body>, outside of the globalWrapper ...
[lhc/web/wiklou.git] / t / inc / Xml.t
1 #!/usr/bin/env php
2 <?php
3
4 require 't/Test.php';
5
6 plan( 8 );
7
8 require_ok( 'includes/Sanitizer.php' );
9 require_ok( 'includes/Xml.php' );
10
11 #
12 # element
13 #
14
15 cmp_ok(
16 Xml::element( 'element', null, null ),
17 '==',
18 '<element>',
19 'Opening element with no attributes'
20 );
21
22 cmp_ok(
23 Xml::element( 'element', null, '' ),
24 '==',
25 '<element />',
26 'Terminated empty element'
27 );
28
29 cmp_ok(
30 Xml::element( 'element', null, 'hello <there> you & you' ),
31 '==',
32 '<element>hello &lt;there&gt; you &amp; you</element>',
33 'Element with no attributes and content that needs escaping'
34 );
35
36 cmp_ok(
37 Xml::element( 'element', array( 'key' => 'value', '<>' => '<>' ), null ),
38 '==',
39 '<element key="value" <>="&lt;&gt;">',
40 'Element attributes, keys are not escaped'
41 );
42
43 #
44 # open/close element
45 #
46
47 cmp_ok(
48 Xml::openElement( 'element', array( 'k' => 'v' ) ),
49 '==',
50 '<element k="v">',
51 'openElement() shortcut'
52 );
53
54 cmp_ok( Xml::closeElement( 'element' ), '==', '</element>', 'closeElement() shortcut' );
55
56 /* vim: set filetype=php: */