From c0b83ba2be76bcc51c97549bf5328a9c8e97a748 Mon Sep 17 00:00:00 2001 From: Rodrigo Wanderley de Melo Cardoso Date: Sun, 28 Sep 2014 19:03:32 -0300 Subject: [PATCH 1/5] teste basico da funcao timezone_version_get --- ext/date/tests/timezone_version_get_basic1.phpt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ext/date/tests/timezone_version_get_basic1.phpt diff --git a/ext/date/tests/timezone_version_get_basic1.phpt b/ext/date/tests/timezone_version_get_basic1.phpt new file mode 100644 index 00000000000..27224e3d44e --- /dev/null +++ b/ext/date/tests/timezone_version_get_basic1.phpt @@ -0,0 +1,12 @@ +--TEST-- +timezone_version_get: Test that timezone_location_get returns a date concatenated with a dot and a version number +--CREDITS-- +Rodrigo Wanderley de Melo Cardoso +#PHPTestFest2014 São Paulo 2014-07-05 +--INI-- +date.timezone=UTC +--FILE-- + +--EXPECTREGEX-- +^[12][0-9]{3}.[0-9]+$ \ No newline at end of file From 813830e763514a0b716c4813c4c57c8e82401be7 Mon Sep 17 00:00:00 2001 From: Rodrigo Prado de Jesus Date: Sat, 5 Jul 2014 17:25:11 -0300 Subject: [PATCH 2/5] added various tests for XSLTProcessor and one test for iconv extension --- ext/iconv/tests/iconv_basic_001.phpt | 18 ++++++ .../tests/xsltprocessor_hasExsltSupport.phpt | 13 ++++ ...sExsltSupport_not_available_extension.phpt | 13 ++++ ...cessor_hasExsltSupport_wrongparam_001.phpt | 13 ++++ .../tests/xsltprocessor_transformToDoc.phpt | 51 ++++++++++++++++ ...sltprocessor_transformToDoc_nullparam.phpt | 54 ++++++++++++++++ ...ocessor_transformToDoc_wrongparam_001.phpt | 56 +++++++++++++++++ ...ocessor_transformToDoc_wrongparam_002.phpt | 54 ++++++++++++++++ ...ocessor_transformToDoc_wrongparam_003.phpt | 56 +++++++++++++++++ ...ocessor_transformToDoc_wrongparam_004.phpt | 56 +++++++++++++++++ .../tests/xsltprocessor_transformToURI.phpt | 53 ++++++++++++++++ ...sltprocessor_transformToURI_nullparam.phpt | 54 ++++++++++++++++ ...ocessor_transformToURI_wrongparam_001.phpt | 57 +++++++++++++++++ ...ocessor_transformToURI_wrongparam_002.phpt | 57 +++++++++++++++++ ...ocessor_transformToURI_wrongparam_003.phpt | 57 +++++++++++++++++ ...ocessor_transformToURI_wrongparam_004.phpt | 56 +++++++++++++++++ .../tests/xsltprocessor_transformToXML.phpt | 61 +++++++++++++++++++ ...sltprocessor_transformToXML_nullparam.phpt | 54 ++++++++++++++++ ...ocessor_transformToXML_wrongparam_001.phpt | 55 +++++++++++++++++ ...ocessor_transformToXML_wrongparam_002.phpt | 54 ++++++++++++++++ ...ocessor_transformToXML_wrongparam_003.phpt | 55 +++++++++++++++++ ...ocessor_transformToXML_wrongparam_004.phpt | 55 +++++++++++++++++ 22 files changed, 1052 insertions(+) create mode 100644 ext/iconv/tests/iconv_basic_001.phpt create mode 100644 ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt create mode 100644 ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt create mode 100644 ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt diff --git a/ext/iconv/tests/iconv_basic_001.phpt b/ext/iconv/tests/iconv_basic_001.phpt new file mode 100644 index 00000000000..e5c5ddc4283 --- /dev/null +++ b/ext/iconv/tests/iconv_basic_001.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test the basics to function iconv. +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(15) "Zlutoucky kun\n" \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt b/ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt new file mode 100644 index 00000000000..22671293074 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test the basics to function XSLTProcessor::hasExsltSupport(). +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- +hasExsltSupport()); +?> +--EXPECTF-- +bool(true) \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt b/ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt new file mode 100644 index 00000000000..d8b8fa846dc --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test the basics to function XSLTProcessor::hasExsltSupport() when the xsl extension os not available. +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- +hasExsltSupport()); +?> +--EXPECTF-- +Fatal error: Class 'XSLTProcessor' not found in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt new file mode 100644 index 00000000000..107157fa284 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt @@ -0,0 +1,13 @@ +--TEST-- +Check XSLTProcessor::hasExsltSupport() with 1 parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- +hasExsltSupport('stringValue')); +?> +--EXPECTF-- +bool(true) \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc.phpt new file mode 100644 index 00000000000..ff4be47e3fe --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test the basics to function XSLTProcessor::transformToDoc(). +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + royopa + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +var_dump($proc->transformToDoc($xmldoc)->firstChild->tagName); +?> +--EXPECT-- +string(4) "html" \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt new file mode 100644 index 00000000000..735fd72958d --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt @@ -0,0 +1,54 @@ +--TEST-- +Check XSLTProcessor::transformToDoc() with null parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +echo $proc->transformToDoc(null); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, null given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt new file mode 100644 index 00000000000..1460de39a46 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt @@ -0,0 +1,56 @@ +--TEST-- +Check XSLTProcessor::transformToDoc() with array parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = array(); + +echo $proc->transformToDoc($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, array given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt new file mode 100644 index 00000000000..2c6c99ae254 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt @@ -0,0 +1,54 @@ +--TEST-- +Check XSLTProcessor::transformToDoc() with 4 parameters +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +echo $proc->transformToDoc($xmldoc, 'string', 98, true); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToDoc() expects at most 2 parameters, 4 given in %s on line %i diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt new file mode 100644 index 00000000000..19fc3e44ef6 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt @@ -0,0 +1,56 @@ +--TEST-- +Check XSLTProcessor::transformToDoc() with string parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = 'stringValue'; + +echo $proc->transformToDoc($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, string given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt new file mode 100644 index 00000000000..8df84b7cbe1 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt @@ -0,0 +1,56 @@ +--TEST-- +Check XSLTProcessor::transformToDoc() with boolean parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = true; + +echo $proc->transformToDoc($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, boolean given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI.phpt b/ext/xsl/tests/xsltprocessor_transformToURI.phpt new file mode 100644 index 00000000000..27ed4e2975c --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test the basics to function XSLTProcessor::transformToURI(). +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + + + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +var_dump($proc->transformToURI($xsldoc, 'php://output')); +?> +--EXPECTF-- +int(56) \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt new file mode 100644 index 00000000000..69afeaf7bed --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt @@ -0,0 +1,54 @@ +--TEST-- +Check XSLTProcessor::transformToURI() with null parameters +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +echo $proc->transformToURI(null, null); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, null given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt new file mode 100644 index 00000000000..64b98ce7e57 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt @@ -0,0 +1,57 @@ +--TEST-- +Check XSLTProcessor::transformToURI() with array parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = array(); +$uri = 'php://output'; + +echo $proc->transformToURI($wrong_parameter, $uri); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, array given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt new file mode 100644 index 00000000000..7f497ba2b86 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt @@ -0,0 +1,57 @@ +--TEST-- +Check XSLTProcessor::transformToURI() with string parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = 'stringValue'; +$uri = 'php://output'; + +echo $proc->transformToURI($wrong_parameter, $uri); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, string given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt new file mode 100644 index 00000000000..c7742422fd9 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt @@ -0,0 +1,57 @@ +--TEST-- +Check XSLTProcessor::transformToURI() with boolean parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = false; +$uri = 'php://output'; + +echo $proc->transformToURI($wrong_parameter, $uri); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, boolean given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt new file mode 100644 index 00000000000..c1de1d93c3e --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt @@ -0,0 +1,56 @@ +--TEST-- +Check XSLTProcessor::transformToURI() with 3 parameters +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$uri = 'php://output'; + +echo $proc->transformToURI($xsldoc, $uri, 'stringValue'); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToUri() expects exactly 2 parameters, 3 given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToXML.phpt b/ext/xsl/tests/xsltprocessor_transformToXML.phpt new file mode 100644 index 00000000000..c70200d1029 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test the basics to function XSLTProcessor::transformToXml(). +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +var_dump($proc->transformToXML($xmldoc)); +?> +--EXPECT-- +string(135) " +

Users

+ + + +
Bob
Joe
+ +" \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt new file mode 100644 index 00000000000..a7689df0781 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt @@ -0,0 +1,54 @@ +--TEST-- +Check XSLTProcessor::transformToXml() with null parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +echo $proc->transformToXML(null); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, null given in %s on line %i diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt new file mode 100644 index 00000000000..32e1a8095bd --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt @@ -0,0 +1,55 @@ +--TEST-- +Check XSLTProcessor::transformToXML() with array parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = array(); +echo $proc->transformToXML($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, array given in %s on line %d \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt new file mode 100644 index 00000000000..69b9305e131 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt @@ -0,0 +1,54 @@ +--TEST-- +Check XSLTProcessor::transformToXML() with 3 parameters +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +echo $proc->transformToXML($xmldoc, 'string', 98); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToXml() expects exactly 1 parameter, 3 given in %s on line %i diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt new file mode 100644 index 00000000000..05cb7ebd9ec --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt @@ -0,0 +1,55 @@ +--TEST-- +Check XSLTProcessor::transformToXML() with string parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = 'stringValue'; +echo $proc->transformToXML($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, string given in %s on line %d \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt new file mode 100644 index 00000000000..87db6e14d65 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt @@ -0,0 +1,55 @@ +--TEST-- +Check XSLTProcessor::transformToXML() with boolean parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = true; +echo $proc->transformToXML($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, boolean given in %s on line %d \ No newline at end of file From d89b1dad8a3e98c09ed2f96e3ee4dd85dc9bcb8a Mon Sep 17 00:00:00 2001 From: Rodrigo Prado de Jesus Date: Sun, 28 Sep 2014 20:30:52 -0300 Subject: [PATCH 3/5] added some tests to datetime and dateinterval functions --- ...date_interval_create_from_date_string.phpt | 34 +++++++++++++++ ...val_create_from_date_string_nullparam.phpt | 42 +++++++++++++++++++ ...reate_from_date_string_wrongparam_001.phpt | 11 +++++ ...reate_from_date_string_wrongparam_002.phpt | 9 ++++ ext/date/tests/date_timestamp_set.phpt | 19 +++++++++ .../tests/date_timestamp_set_nullparam.phpt | 17 ++++++++ .../tests/date_timestamp_set_nullparam2.phpt | 24 +++++++++++ .../date_timestamp_set_wrongparam_001.phpt | 17 ++++++++ .../date_timestamp_set_wrongparam_002.phpt | 15 +++++++ .../date_timestamp_set_wrongparam_003.phpt | 19 +++++++++ .../date_timestamp_set_wrongparam_004.phpt | 17 ++++++++ ext/date/tests/timezone_version_get.phpt | 13 ++++++ 12 files changed, 237 insertions(+) create mode 100644 ext/date/tests/date_interval_create_from_date_string.phpt create mode 100644 ext/date/tests/date_interval_create_from_date_string_nullparam.phpt create mode 100644 ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt create mode 100644 ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt create mode 100644 ext/date/tests/date_timestamp_set.phpt create mode 100644 ext/date/tests/date_timestamp_set_nullparam.phpt create mode 100644 ext/date/tests/date_timestamp_set_nullparam2.phpt create mode 100644 ext/date/tests/date_timestamp_set_wrongparam_001.phpt create mode 100644 ext/date/tests/date_timestamp_set_wrongparam_002.phpt create mode 100644 ext/date/tests/date_timestamp_set_wrongparam_003.phpt create mode 100644 ext/date/tests/date_timestamp_set_wrongparam_004.phpt create mode 100644 ext/date/tests/timezone_version_get.phpt diff --git a/ext/date/tests/date_interval_create_from_date_string.phpt b/ext/date/tests/date_interval_create_from_date_string.phpt new file mode 100644 index 00000000000..9a1745c9acf --- /dev/null +++ b/ext/date/tests/date_interval_create_from_date_string.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test date_interval_create_from_date_string() function : basic functionality +--CREDITS-- +Rodrigo Prado de Jesus +--FILE-- +d); + +$string = '2 weeks'; //14 days +$i = date_interval_create_from_date_string($string); +var_dump($i->d); + +$string = '3 months'; +$i = date_interval_create_from_date_string($string); +var_dump($i->m); + +$string = '4 years'; +$i = date_interval_create_from_date_string($string); +var_dump($i->y); + +$string = '1 year + 1 day'; +$i = date_interval_create_from_date_string($string); +var_dump($i->y); +var_dump($i->d); +?> +--EXPECTF-- +int(1) +int(14) +int(3) +int(4) +int(1) +int(1) \ No newline at end of file diff --git a/ext/date/tests/date_interval_create_from_date_string_nullparam.phpt b/ext/date/tests/date_interval_create_from_date_string_nullparam.phpt new file mode 100644 index 00000000000..369db5714ac --- /dev/null +++ b/ext/date/tests/date_interval_create_from_date_string_nullparam.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test date_interval_create_from_date_string() function : null parameter +--CREDITS-- +Rodrigo Prado de Jesus +--FILE-- + +--EXPECTF-- +object(DateInterval)#1 (15) { + ["y"]=> + int(0) + ["m"]=> + int(0) + ["d"]=> + int(0) + ["h"]=> + int(0) + ["i"]=> + int(0) + ["s"]=> + int(0) + ["weekday"]=> + int(0) + ["weekday_behavior"]=> + int(0) + ["first_last_day_of"]=> + int(0) + ["invert"]=> + int(0) + ["days"]=> + int(0) + ["special_type"]=> + int(0) + ["special_amount"]=> + int(0) + ["have_weekday_relative"]=> + int(0) + ["have_special_relative"]=> + int(0) +} \ No newline at end of file diff --git a/ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt b/ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt new file mode 100644 index 00000000000..15db956553f --- /dev/null +++ b/ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt @@ -0,0 +1,11 @@ +--TEST-- +Test date_interval_create_from_date_string() function : wrong parameter (array) +--CREDITS-- +Rodrigo Prado de Jesus +--FILE-- + +--EXPECTF-- +Warning: date_interval_create_from_date_string() expects parameter 1 to be string, array given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt b/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt new file mode 100644 index 00000000000..a3407c39679 --- /dev/null +++ b/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt @@ -0,0 +1,9 @@ +--TEST-- +Test date_interval_create_from_date_string() function : with 2 parameters (wrong). +Rodrigo Prado de Jesus +--FILE-- + +--EXPECTF-- +Warning: date_interval_create_from_date_string() expects exactly 1 parameter, 2 given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set.phpt b/ext/date/tests/date_timestamp_set.phpt new file mode 100644 index 00000000000..e01660193f1 --- /dev/null +++ b/ext/date/tests/date_timestamp_set.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test the basics to function date_timestamp_set(). +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + (U) => T Y-M-d H:i:s')); +?> +--EXPECTF-- +string(47) "021 => (1234567890) => UTC 2009-Feb-13 23:31:30" \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_nullparam.phpt b/ext/date/tests/date_timestamp_set_nullparam.phpt new file mode 100644 index 00000000000..1bcb800242b --- /dev/null +++ b/ext/date/tests/date_timestamp_set_nullparam.phpt @@ -0,0 +1,17 @@ +--TEST-- +Test the function date_timestamp_set() with first null parameter. +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +Warning: date_timestamp_set() expects parameter 1 to be DateTime, null given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_nullparam2.phpt b/ext/date/tests/date_timestamp_set_nullparam2.phpt new file mode 100644 index 00000000000..1442da4426f --- /dev/null +++ b/ext/date/tests/date_timestamp_set_nullparam2.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test the function date_timestamp_set() with second null parameter. +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +object(DateTime)#1 (3) { + ["date"]=> + string(26) "1970-01-01 00:00:00.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" +} \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_wrongparam_001.phpt b/ext/date/tests/date_timestamp_set_wrongparam_001.phpt new file mode 100644 index 00000000000..9a0fca99c1d --- /dev/null +++ b/ext/date/tests/date_timestamp_set_wrongparam_001.phpt @@ -0,0 +1,17 @@ +--TEST-- +Check the function date_timestamp_set() with first parameter wrong (array). +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +Warning: date_timestamp_set() expects parameter 1 to be DateTime, array given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_wrongparam_002.phpt b/ext/date/tests/date_timestamp_set_wrongparam_002.phpt new file mode 100644 index 00000000000..ed31cb217d7 --- /dev/null +++ b/ext/date/tests/date_timestamp_set_wrongparam_002.phpt @@ -0,0 +1,15 @@ +--TEST-- +Check the function date_timestamp_set() with first parameter wrong (integer). +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +Warning: date_timestamp_set() expects parameter 1 to be DateTime, integer given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_wrongparam_003.phpt b/ext/date/tests/date_timestamp_set_wrongparam_003.phpt new file mode 100644 index 00000000000..f965334d9de --- /dev/null +++ b/ext/date/tests/date_timestamp_set_wrongparam_003.phpt @@ -0,0 +1,19 @@ +--TEST-- +Check the function date_timestamp_set() with second parameter wrong (array). +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +Warning: date_timestamp_set() expects parameter 2 to be long, array given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_wrongparam_004.phpt b/ext/date/tests/date_timestamp_set_wrongparam_004.phpt new file mode 100644 index 00000000000..b171e98bd46 --- /dev/null +++ b/ext/date/tests/date_timestamp_set_wrongparam_004.phpt @@ -0,0 +1,17 @@ +--TEST-- +Check the function date_timestamp_set() with 3 parameters. +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +Warning: date_timestamp_set() expects exactly 2 parameters, 3 given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/timezone_version_get.phpt b/ext/date/tests/timezone_version_get.phpt new file mode 100644 index 00000000000..e0760042896 --- /dev/null +++ b/ext/date/tests/timezone_version_get.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test the basics to function timezone_version_get(). +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTREGEX-- +string\([6-7]\) \"20[0-9][0-9]\.[1-9][0-9]?\" \ No newline at end of file From 8cd23d49db3482bf408c82f6287d8df5988b072d Mon Sep 17 00:00:00 2001 From: Pedro MFA Evangelista Date: Sat, 5 Jul 2014 17:20:30 -0300 Subject: [PATCH 4/5] Add a test for the exception cases of readline_read_history --- .../tests/readline_read_history_error_001.phpt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ext/readline/tests/readline_read_history_error_001.phpt diff --git a/ext/readline/tests/readline_read_history_error_001.phpt b/ext/readline/tests/readline_read_history_error_001.phpt new file mode 100644 index 00000000000..db1e001694a --- /dev/null +++ b/ext/readline/tests/readline_read_history_error_001.phpt @@ -0,0 +1,12 @@ +--TEST-- +readline_read_history() function - Error cases +--SKIPIF-- + +--EXPECT-- +bool(false) +bool(false) From 2c6ecbbea110328970ea4265a1b0245e692f8f3f Mon Sep 17 00:00:00 2001 From: Pedro MFA Evangelista Date: Sat, 5 Jul 2014 17:30:05 -0300 Subject: [PATCH 5/5] Add my information to this test --- ext/readline/tests/readline_read_history_error_001.phpt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/readline/tests/readline_read_history_error_001.phpt b/ext/readline/tests/readline_read_history_error_001.phpt index db1e001694a..0a65a66d5cd 100644 --- a/ext/readline/tests/readline_read_history_error_001.phpt +++ b/ext/readline/tests/readline_read_history_error_001.phpt @@ -1,7 +1,9 @@ --TEST-- readline_read_history() function - Error cases +--CREDITS-- +Pedro Manoel Evangelista --SKIPIF-- - --FILE--