felipe Sat May 23 14:45:07 2009 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/xsl/tests xsl-phpinfo.phpt
xsltprocessor_getParameter-invalidparam.phpt
xsltprocessor_getParameter-wrongparam.phpt
xsltprocessor_getParameter.phpt
xsltprocessor_registerPHPFunctions-allfuncs.phpt
xsltprocessor_registerPHPFunctions-array-multiple.phpt
xsltprocessor_registerPHPFunctions-array-notallowed.phpt
xsltprocessor_registerPHPFunctions-array.phpt
xsltprocessor_registerPHPFunctions-funcnostring.phpt
xsltprocessor_registerPHPFunctions-funcundef.phpt
xsltprocessor_registerPHPFunctions-null.phpt
xsltprocessor_registerPHPFunctions-string-multiple.phpt
xsltprocessor_registerPHPFunctions-string-notallowed.phpt
xsltprocessor_registerPHPFunctions-string.phpt
xsltprocessor_removeParameter-invalidparam.phpt
xsltprocessor_removeParameter-wrongparams.phpt
xsltprocessor_removeParameter.phpt
xsltprocessor_setparameter-errorquote.phpt
xsltprocessor_setparameter-nostring.phpt
Log:
- New tests (testfest BerlinUG)
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsl-phpinfo.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsl-phpinfo.phpt
+++ php-src/ext/xsl/tests/xsl-phpinfo.phpt
--TEST--
Test phpinfo() displays xsl info
--SKIPIF--
<?php
if (!extension_loaded("xsl")) {
die("SKIP extension gettext not loaded\n");
}
?>
--FILE--
<?php
phpinfo();
?>
--EXPECTF--
%a
libxslt compiled against libxml Version%a
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_getParameter-invalidparam.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_getParameter-invalidparam.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_getParameter-invalidparam.phpt
--TEST--
Check xsltprocessor::getParameter with undefined parameter
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
var_dump($proc->getParameter('', 'doesnotexist'));
--EXPECTF--
bool(false)
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_getParameter-wrongparam.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_getParameter-wrongparam.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_getParameter-wrongparam.phpt
--TEST--
Check xsltprocessor::getparameter error handling
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
var_dump($proc->getParameter());
var_dump($proc->getParameter(array(), array()));
var_dump($proc->getParameter('', array()));
--EXPECTF--
Warning: XSLTProcessor::getParameter() expects exactly 2 parameters, 0 given in
%s on line %d
bool(false)
Warning: XSLTProcessor::getParameter() expects parameter 1 to be
%binary_string_optional%, array given in %s on line %d
bool(false)
Warning: XSLTProcessor::getParameter() expects parameter 2 to be
%binary_string_optional%, array given in %s on line %d
bool(false)
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_getParameter.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_getParameter.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_getParameter.phpt
--TEST--
Check xsltprocessor::getparameter functionality
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$proc->importStylesheet($xsl);
$proc->setParameter('', 'key', 'value');
var_dump($proc->getParameter('', 'key'));
--EXPECTF--
%string|unicode%(5) "value"
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-allfuncs.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-allfuncs.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-allfuncs.phpt
--TEST--
Check xsltprocessor::registerPHPFunctions
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$phpfuncxsl = new domDocument();
$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
if(!$phpfuncxsl) {
echo "Error while parsing the xsl document\n";
exit;
}
$proc->importStylesheet($phpfuncxsl);
var_dump($proc->registerPHPFunctions());
var_dump($proc->transformToXml($dom));
//var_dump($proc->registerPHPFunctions(array()));
//var_dump($proc->transformToXml($dom));
--EXPECTF--
NULL
string(18) "This Is An Example"
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-multiple.phpt?view=markup&rev=1.1
Index:
php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-multiple.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-multiple.phpt
--TEST--
Check xsltprocessor::registerPHPFunctions with array called multiple times
--DESCRIPTION--
When being called multiple times with an array,
registerPHPFunctions adds the new functions to the allowed parameter
list - it does not replace the previously allowed functions.
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$phpfuncxsl = new domDocument();
$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
if(!$phpfuncxsl) {
echo "Error while parsing the xsl document\n";
exit;
}
$proc->importStylesheet($phpfuncxsl);
var_dump($proc->registerPHPFunctions(array('strpos', 'ucwords')));
var_dump($proc->registerPHPFunctions(array('strrev', 'array_key_exists')));
var_dump($proc->registerPHPFunctions(array()));
var_dump($proc->transformToXml($dom));
--EXPECTF--
NULL
NULL
NULL
string(18) "This Is An Example"
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-notallowed.phpt?view=markup&rev=1.1
Index:
php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-notallowed.phpt
+++
php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-notallowed.phpt
--TEST--
Check xsltprocessor::registerPHPFunctions with array and a not allowed function
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$phpfuncxsl = new domDocument();
$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
if(!$phpfuncxsl) {
echo "Error while parsing the xsl document\n";
exit;
}
$proc->importStylesheet($phpfuncxsl);
var_dump($proc->registerPHPFunctions(array()));
var_dump($proc->transformToXml($dom));
--EXPECTF--
NULL
Warning: XSLTProcessor::transformToXml(): Not allowed to call handler
'ucwords()' in %s on line %d
NULL
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array.phpt
--TEST--
Check xsltprocessor::registerPHPFunctions with array
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$phpfuncxsl = new domDocument();
$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
if(!$phpfuncxsl) {
echo "Error while parsing the xsl document\n";
exit;
}
$proc->importStylesheet($phpfuncxsl);
var_dump($proc->registerPHPFunctions(array('ucwords')));
var_dump($proc->transformToXml($dom));
--EXPECTF--
NULL
string(18) "This Is An Example"
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt?view=markup&rev=1.1
Index:
php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
--TEST--
Check xsltprocessor::registerPHPFunctions and a non-string function in xsl
--DESCRIPTION--
The XSL script tries to call a php function that is not a string which
is expected to fail
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$phpfuncxsl = new domDocument();
$phpfuncxsl->load(dirname(__FILE__)."/phpfunc-nostring.xsl");
if(!$phpfuncxsl) {
echo "Error while parsing the xsl document\n";
exit;
}
$proc->importStylesheet($phpfuncxsl);
var_dump($proc->registerPHPFunctions());
var_dump($proc->transformToXml($dom));
--EXPECTF--
NULL
Warning: XSLTProcessor::transformToXml(): Handler name must be a string in %s
on line %d
Warning: XSLTProcessor::transformToXml(): xmlXPathCompiledEval: evaluation
failed in %s on line %d
Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d
element value-of in %s on line %d
Warning: XSLTProcessor::transformToXml(): XPath evaluation returned no result.
in %s on line %d
NULL
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
--TEST--
Check xsltprocessor::registerPHPFunctions and a undefined php function
--DESCRIPTION--
The XSL script tries to call a php function that is not defined
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$phpfuncxsl = new domDocument();
$phpfuncxsl->load(dirname(__FILE__)."/phpfunc-undef.xsl");
if(!$phpfuncxsl) {
echo "Error while parsing the xsl document\n";
exit;
}
$proc->importStylesheet($phpfuncxsl);
var_dump($proc->registerPHPFunctions());
var_dump($proc->transformToXml($dom));
--EXPECTF--
NULL
Warning: XSLTProcessor::transformToXml(): Unable to call handler
undefinedfunc() in %s on line %d
Warning: XSLTProcessor::transformToXml(): xmlXPathCompiledEval: evaluation
failed in %s on line %d
Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d
element value-of in %s on line %d
Warning: XSLTProcessor::transformToXml(): XPath evaluation returned no result.
in %s on line %d
NULL
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-null.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-null.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-null.phpt
--TEST--
Check xsltprocessor::registerPHPFunctions called with null to reset
--DESCRIPTION--
When being called multiple times with an array,
registerPHPFunctions adds the new functions to the allowed parameter
list - it does not replace the previously allowed functions.
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$phpfuncxsl = new domDocument();
$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
if(!$phpfuncxsl) {
echo "Error while parsing the xsl document\n";
exit;
}
$proc->importStylesheet($phpfuncxsl);
var_dump($proc->registerPHPFunctions('ucwords'));
var_dump($proc->registerPHPFunctions(null));
var_dump($proc->transformToXml($dom));
--EXPECTF--
NULL
NULL
string(18) "This Is An Example"
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-multiple.phpt?view=markup&rev=1.1
Index:
php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-multiple.phpt
+++
php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-multiple.phpt
--TEST--
Check xsltprocessor::registerPHPFunctions with string called multiple times
--DESCRIPTION--
When being called multiple times with a stringular function name only,
registerPHPFunctions adds the new function to the allowed parameter
list - it does not replace the old function.
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$phpfuncxsl = new domDocument();
$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
if(!$phpfuncxsl) {
echo "Error while parsing the xsl document\n";
exit;
}
$proc->importStylesheet($phpfuncxsl);
var_dump($proc->registerPHPFunctions('ucwords'));
var_dump($proc->registerPHPFunctions('strpos'));
var_dump($proc->transformToXml($dom));
--EXPECTF--
NULL
NULL
string(18) "This Is An Example"
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-notallowed.phpt?view=markup&rev=1.1
Index:
php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-notallowed.phpt
+++
php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-notallowed.phpt
--TEST--
Check xsltprocessor::registerPHPFunctions with string and not allowed function
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$phpfuncxsl = new domDocument();
$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
if(!$phpfuncxsl) {
echo "Error while parsing the xsl document\n";
exit;
}
$proc->importStylesheet($phpfuncxsl);
var_dump($proc->registerPHPFunctions('strpos'));
var_dump($proc->transformToXml($dom));
--EXPECTF--
NULL
Warning: XSLTProcessor::transformToXml(): Not allowed to call handler
'ucwords()' in %s on line %d
NULL
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string.phpt
--TEST--
Check xsltprocessor::registerPHPFunctions with string
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$phpfuncxsl = new domDocument();
$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
if(!$phpfuncxsl) {
echo "Error while parsing the xsl document\n";
exit;
}
$proc->importStylesheet($phpfuncxsl);
var_dump($proc->registerPHPFunctions('ucwords'));
var_dump($proc->transformToXml($dom));
--EXPECTF--
NULL
string(18) "This Is An Example"
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_removeParameter-invalidparam.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_removeParameter-invalidparam.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_removeParameter-invalidparam.phpt
--TEST--
Check xsltprocessor::removeParameter with invalid parameter
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$proc->importStylesheet($xsl);
var_dump($proc->removeParameter('', 'doesnotexist'));
--EXPECT--
bool(false)
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_removeParameter-wrongparams.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_removeParameter-wrongparams.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_removeParameter-wrongparams.phpt
--TEST--
Check xsltprocessor::removeParameter wrong parameter handling
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$proc->removeParameter();
$proc->removeParameter(array(), array());
$proc->removeParameter('', array());
--EXPECTF--
Warning: XSLTProcessor::removeParameter() expects exactly 2 parameters, 0 given
in %s on line %d
Warning: XSLTProcessor::removeParameter() expects parameter 1 to be
%binary_string_optional%, array given in %s on line %d
Warning: XSLTProcessor::removeParameter() expects parameter 2 to be
%binary_string_optional%, array given in %s on line %d
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_removeParameter.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_removeParameter.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_removeParameter.phpt
--TEST--
Check xsltprocessor::removeParameter functionality
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$proc->importStylesheet($xsl);
$proc->setParameter('', 'key', 'value');
$proc->removeParameter('', 'key');
var_dump($proc->getParameter('', 'key'));
--EXPECT--
bool(false)
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_setparameter-errorquote.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_setparameter-errorquote.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_setparameter-errorquote.phpt
--TEST--
Check xsltprocessor::setparameter error handling with both single and double
quotes
--DESCRIPTION--
Memleak: http://bugs.php.net/bug.php?id=48221
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$proc->importStylesheet($xsl);
$proc->setParameter('', '', '"\'');
$proc->transformToXml($dom);
--EXPECTF--
Warning: XSLTProcessor::transformToXml(): Cannot create XPath expression
(string contains both quote and double-quotes) in %s on line %d
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/tests/xsltprocessor_setparameter-nostring.phpt?view=markup&rev=1.1
Index: php-src/ext/xsl/tests/xsltprocessor_setparameter-nostring.phpt
+++ php-src/ext/xsl/tests/xsltprocessor_setparameter-nostring.phpt
--TEST--
Check xsltprocessor::setparameter error handling with no-string
--DESCRIPTION--
Memleak: http://bugs.php.net/bug.php?id=48221
--SKIPIF--
<?php
if (!extension_loaded('xsl')) {
die("skip\n");
}
?>
--FILE--
<?php
include dirname(__FILE__) .'/prepare.inc';
$proc->importStylesheet($xsl);
var_dump($proc->setParameter('', array(4, 'abc')));
$proc->transformToXml($dom);
--EXPECTF--
Warning: XSLTProcessor::setParameter(): Invalid parameter array in %s on line %d
bool(false)
--CREDITS--
Christian Weiske, [email protected]
PHP Testfest Berlin 2009-05-09
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php