]> git.sesse.net Git - xml-template/commitdiff
Add most of the remaining php5-swig tests. Most succeed, but not all.
authorsgunderson@bigfoot.com <>
Thu, 22 Sep 2011 21:11:12 +0000 (23:11 +0200)
committersgunderson@bigfoot.com <>
Thu, 22 Sep 2011 21:11:12 +0000 (23:11 +0200)
php5-swig/attribute-empty.php [new file with mode: 0644]
php5-swig/attribute.php [new file with mode: 0644]
php5-swig/attribute2.php [new file with mode: 0644]
php5-swig/attribute3.php [new file with mode: 0644]
php5-swig/include.php [new file with mode: 0644]
php5-swig/namespace.php [new file with mode: 0644]
php5-swig/namespace2.php [new file with mode: 0644]
php5-swig/structure.php [new file with mode: 0644]

diff --git a/php5-swig/attribute-empty.php b/php5-swig/attribute-empty.php
new file mode 100644 (file)
index 0000000..5a33f63
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+dl("XML_Template_SWIG.so");
+
+# NULL values are ignored, but having one helps pointing out that
+# the array given is non-associative
+
+$doc = process_file('../xml/clone.xml', array(
+       'color' => 'blue',
+       '#things' => array(NULL)
+), true);
+output_to_fd_and_free($doc, 1);
+?>
diff --git a/php5-swig/attribute.php b/php5-swig/attribute.php
new file mode 100644 (file)
index 0000000..fa5a0df
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+
+dl("XML_Template_SWIG.so");
+$doc = process_file('../xml/clone.xml', array(
+       'color' => 'red',
+       '#things' => array(
+               array( 'li' => 'Raindrops on roses',    'li/class' => 'odd' ),
+               array( 'li' => 'Whiskers on kittens',   'li/class' => 'even' ),
+               array( 'li' => 'Bright copper kettles', 'li/class' => 'odd' ),
+               array( 'li' => 'Warm, woolen mittens',  'li/class' => 'even' )
+       )
+), true);
+output_to_fd_and_free($doc, 1);
+?>
diff --git a/php5-swig/attribute2.php b/php5-swig/attribute2.php
new file mode 100644 (file)
index 0000000..adcad31
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+
+dl("XML_Template_SWIG.so");
+$doc = process_file('../xml/clone.xml', array(
+       'color' => 'blue',
+       '#things' => XML_Template_alternate('li/class', array(
+               array( 'li' => 'Raindrops on roses' ),
+               array( 'li' => 'Whiskers on kittens' ),
+               array( 'li' => 'Bright copper kettles' ),
+               array( 'li' => 'Warm, woolen mittens' ),
+       ), array('odd', 'even'))
+), true);
+output_to_fd_and_free($doc, 1);
+?>
diff --git a/php5-swig/attribute3.php b/php5-swig/attribute3.php
new file mode 100644 (file)
index 0000000..8b84e7d
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+
+dl("XML_Template_SWIG.so");
+$doc = process_file('../xml/clone.xml', array(
+       'color' => 'blue',
+       '#things' => XML_Template_alternate('li/class', array(
+               array( 'li' => 'Raindrops on roses' ),
+               array( 'li' => 'Whiskers on kittens' ),
+               NULL,
+               array( 'li' => 'Bright copper kettles' ),
+               array( 'li' => 'Warm, woolen mittens' ),
+       ), array('odd', 'even'))
+), true);
+output_to_fd_and_free($doc, 1);
+?>
diff --git a/php5-swig/include.php b/php5-swig/include.php
new file mode 100644 (file)
index 0000000..5e3ff4e
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+dl("XML_Template_SWIG.so");
+$doc = process_file('../xml/included.xml', array(
+       'color' => 'red'
+), 0);
+$master = process_file('../xml/master.xml', array(
+       'title' => 'Main HTML title',
+       'h1' => 'Nice heading here',
+       'contents' => $doc
+), true);
+output_to_fd_and_free($doc, 1);
+?>
diff --git a/php5-swig/namespace.php b/php5-swig/namespace.php
new file mode 100644 (file)
index 0000000..1dfc9b9
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+dl("XML_Template_SWIG.so");
+$doc = process_file('../xml/namespace.xml', array( 
+       'title' => 'Namespace tests',
+       '#hello' => 'Hello world!',
+       '#test' => 'Replaced.',
+       'tagname' => 'foo',
+       '#moretest' => 'bar'
+), true);
+output_to_fd_and_free($doc, 1);
+?>
diff --git a/php5-swig/namespace2.php b/php5-swig/namespace2.php
new file mode 100644 (file)
index 0000000..a4c4426
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+
+dl("XML_Template_SWIG.so");
+$doc = process_file('../xml/namespace2.xml', array( 
+       'title' => 'Namespace tests',
+       '#hello' => 'Replaced.',
+), true);
+output_to_fd_and_free($doc, 1);
+?>
diff --git a/php5-swig/structure.php b/php5-swig/structure.php
new file mode 100644 (file)
index 0000000..c3a684e
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+dl("XML_Template_SWIG.so");
+$doc = process_file('../xml/structure.xml', array(
+       '#outer' => array(
+               array( '#inner' => 'One' ),
+               array( '#inner' => 'Two' ),
+               array( '#inner' => 'Three' ),
+       )
+), true);
+output_to_fd_and_free($doc, 1);
+?>