Annotation of embedaddon/php/ext/xsl/tests/xslt011.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test 11: php:function Support
! 3: --SKIPIF--
! 4: <?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
! 5: --FILE--
! 6: <?php
! 7: print "Test 11: php:function Support\n";
! 8: Class foo {
! 9: function foo() {}
! 10: function __toString() { return "not a DomNode object";}
! 11: }
! 12:
! 13: $dom = new domDocument();
! 14: $dom->load(dirname(__FILE__)."/xslt011.xsl");
! 15: $proc = new xsltprocessor;
! 16: $xsl = $proc->importStylesheet($dom);
! 17:
! 18: $xml = new DomDocument();
! 19: $xml->load(dirname(__FILE__)."/xslt011.xml");
! 20: $proc->registerPHPFunctions();
! 21: print $proc->transformToXml($xml);
! 22:
! 23: function foobar($id, $secondArg = "" ) {
! 24: if (is_array($id)) {
! 25: return $id[0]->value . " - " . $secondArg;
! 26: } else {
! 27: return $id . " - " . $secondArg;
! 28: }
! 29: }
! 30: function nodeSet($id = null) {
! 31: if ($id and is_array($id)) {
! 32: return $id[0];
! 33: } else {
! 34: $dom = new domdocument;
! 35: $dom->loadXML("<root>this is from an external DomDocument</root>");
! 36: return $dom->documentElement;
! 37: }
! 38: }
! 39: function nonDomNode() {
! 40: return new foo();
! 41: }
! 42:
! 43: class aClass {
! 44: static function aStaticFunction($id) {
! 45: return $id;
! 46: }
! 47: }
! 48:
! 49: --EXPECTF--
! 50: Test 11: php:function Support
! 51:
! 52: Warning: XSLTProcessor::transformToXml(): A PHP Object cannot be converted to a XPath-string in %s on line 16
! 53: <?xml version="1.0"?>
! 54: foobar - secondArg
! 55: foobar -
! 56: this is from an external DomDocument
! 57: from the Input Document
! 58: static
! 59:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>