Improve testkit for xslt.

002.phpt and 003.phpt are regression tests for reported bugs.
 004.phpt has been known to cause problems in some Sab/PHP combinations.
 No known reports in bug db for that one.
 Added skip mechanism
@- Added regression test for bugs #17791 and #17931 (Melvyn)
This commit is contained in:
Melvyn Sopacua 2002-10-04 11:41:34 +00:00
parent 7f1ad2395d
commit c4805ffeb1
4 changed files with 59 additions and 0 deletions

15
ext/xslt/tests/002.phpt Normal file
View file

@ -0,0 +1,15 @@
--TEST--
Pass long string to 'file' argument, bug #17791
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
$xmlstring = str_repeat('x', 512);
$xslstring = 'x';
$xh = xslt_create();
$result = @xslt_process($xh, $xmlstring, $xslstring);
@xslt_free($xh);
echo("OK");
?>
--EXPECT--
OK

10
ext/xslt/tests/003.phpt Normal file
View file

@ -0,0 +1,10 @@
--TEST--
Pass object for xslt_error_handler, bug #17931
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
include('xslt_set_error_handler.php');
?>
--EXPECT--
OK

View file

@ -0,0 +1,9 @@
<?php
if(!extension_loaded("xslt") && ini_get("enable_dl")) {
$dlext = (substr(PHP_OS, 0, 4) == "WIN") ? ".dll" : ".so";
@dl("xlst$dlext");
}
if(!extension_loaded("xslt")) {
die("skip\n");
}
?>

View file

@ -0,0 +1,25 @@
<?php
class xsl {
function xsl() {
$this->_parser = xslt_create();
}
function set_error() {
xslt_set_error_handler($this->_parser, array($this, 'xslt_trap_error'));
echo "OK";
}
function xslt_trap_error($parser, $errorno, $level, $fields) {
return TRUE;
}
function clean() {
xslt_free($this->_parser);
}
}
$x = new xsl;
// work-around for possible '$this does not exist' bug in constructor
$x->set_error();
$x->clean();
?>