php-src/ext/xslt/tests/005.phpt
Melvyn Sopacua 9bb526c283 (xslt tests) Add test for new backend API (005.phpt), new function
(006.phpt) and a crash test (007.phpt)
             006.phpt also tests handling of public entities, which is in
             essence new to the extension, since there was no way to turn
             it on.
# These new functions and backend will be added shortly.
# TODO: test for xslt_set_object
2002-10-05 19:44:26 +00:00

61 lines
1.7 KiB
PHP

--TEST--
Various ways to provide xml and xslt arguments and params
--SKIPIF--
<?php
include("skipif.inc");
if(!function_exists('utf8_encode')) {
die("skip\n");
}
?>
--FILE--
<?php
error_reporting(E_ALL);
$xmlfile = 'ext/xslt/tests/test.xml';
$xslfile = 'ext/xslt/tests/args.xsl';
$xmldata = @implode('', @file($xmlfile));
$xslsheet = @implode('', @file($xslfile));
$xh = xslt_create();
$result = xslt_process($xh, $xmlfile, $xslfile);
print "$result\n";
$result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata));
print "$result\n";
$result = xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslsheet));
print "$result\n";
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet));
print "$result\n";
// The same, with params
$xslfile = 'ext/xslt/tests/param.xsl';
$xslsheet = implode('', file($xslfile));
$params = array("Test has passed", "PHP QA®");
foreach($params AS $val)
{
$val = utf8_encode($val);
$result = xslt_process($xh, $xmlfile, $xslfile, NULL, NULL, array('insertion' => $val));
print "$result\n";
$result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata), array('insertion' => $val));
print "$result\n";
$result = xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslsheet), array('insertion' => $val));
print "$result\n";
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet), array('insertion' => $val));
print "$result\n";
}
xslt_free($xh);
?>
--EXPECT--
Test has passed
Test has passed
Test has passed
Test has passed
Test has passed
Test has passed
Test has passed
Test has passed
PHP QA®
PHP QA®
PHP QA®
PHP QA®