diff options
34 files changed, 1017 insertions, 31 deletions
diff --git a/ext/dom/tests/DOMDocument_documentURI_basic.phpt b/ext/dom/tests/DOMDocument_documentURI_basic.phpt new file mode 100644 index 0000000000..e40a42b964 --- /dev/null +++ b/ext/dom/tests/DOMDocument_documentURI_basic.phpt @@ -0,0 +1,39 @@ +--TEST-- +Tests DOMDocument::documentURI read and write +--CREDITS-- +Chris Snyder <chsnyder@gmail.com> +# TestFest 2009 NYPHP +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +// create dom document +$dom = new DOMDocument; +$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!DOCTYPE s1 PUBLIC "http://www.ibm.com/example.dtd" "example.dtd"> +<s1>foo</s1>'; +$dom->loadXML($xml); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} +echo "DOMDocument created\n"; + +$test = $dom->documentURI; +echo "Read initial documentURI:\n"; +echo $test."\n"; + +$dom->documentURI = 'http://dom.example.org/example.xml'; +$test = $dom->documentURI; +echo "Set documentURI to a URL, reading again:\n"; +var_dump( $test ); + +echo "Done\n"; +?> +--EXPECTF-- +DOMDocument created +Read initial documentURI: +%s +Set documentURI to a URL, reading again: +string(34) "http://dom.example.org/example.xml" +Done diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_error1.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_error1.phpt new file mode 100755 index 0000000000..51eb82e32f --- /dev/null +++ b/ext/dom/tests/DOMDocument_schemaValidateSource_error1.phpt @@ -0,0 +1,29 @@ +--TEST-- +DomDocument::schemaValidateSource() - string that is not a schema +--CREDITS-- +Daniel Convissor <danielc@php.net> +# TestFest 2009 NYPHP +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +$doc = new DOMDocument; + +$doc->load(dirname(__FILE__)."/book.xml"); + +$result = $doc->schemaValidateSource('string that is not a schema'); +var_dump($result); + +?> +--EXPECTF-- +Warning: DOMDocument::schemaValidateSource(): Entity: line 1: parser error : Start tag expected, '<' not found in %s.php on line %d + +Warning: DOMDocument::schemaValidateSource(): string that is not a schema in %s.php on line %d + +Warning: DOMDocument::schemaValidateSource(): ^ in %s.php on line %d + +Warning: DOMDocument::schemaValidateSource(): Failed to parse the XML resource 'in_memory_buffer'. in %s.php on line %d + +Warning: DOMDocument::schemaValidateSource(): Invalid Schema in %s.php on line %d +bool(false) diff --git a/ext/dom/tests/DOMDocument_standalone_basic.phpt b/ext/dom/tests/DOMDocument_standalone_basic.phpt new file mode 100644 index 0000000000..2316a3897d --- /dev/null +++ b/ext/dom/tests/DOMDocument_standalone_basic.phpt @@ -0,0 +1,48 @@ +--TEST-- +Tests DOMDocument::standalone get, set, and functionality +--CREDITS-- +Chris Snyder <chsnyder@gmail.com> +# TestFest 2009 NYPHP +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +// create dom document +$dom = new DOMDocument; +$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!DOCTYPE s1 PUBLIC "http://www.ibm.com/example.dtd" "example.dtd"> +<s1>foo</s1>'; +$dom->loadXML($xml); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} +echo "Standalone DOMDocument created\n"; + +$test = $dom->standalone; +echo "Read initial standalone:\n"; +var_dump( $test ); + +$dom->standalone = FALSE; +$test = $dom->standalone; +echo "Set standalone to FALSE, reading again:\n"; +var_dump( $test ); + +$test = $dom->saveXML(); +echo "Document is no longer standalone\n"; +var_dump( $test ); + +echo "Done"; +?> +--EXPECT-- +Standalone DOMDocument created +Read initial standalone: +bool(true) +Set standalone to FALSE, reading again: +bool(false) +Document is no longer standalone +string(136) "<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE s1 PUBLIC "http://www.ibm.com/example.dtd" "example.dtd"> +<s1>foo</s1> +" +Done
\ No newline at end of file diff --git a/ext/ftp/tests/ftp_alloc_basic1.phpt b/ext/ftp/tests/ftp_alloc_basic1.phpt new file mode 100755 index 0000000000..b2bdf7440d --- /dev/null +++ b/ext/ftp/tests/ftp_alloc_basic1.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_alloc returns true +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +if (!$ftp) die("Couldn't connect to the server"); +ftp_login($ftp, 'user', 'pass'); + +var_dump(ftp_alloc($ftp, 1024)); +?> +--EXPECT-- +bool(true)
\ No newline at end of file diff --git a/ext/ftp/tests/ftp_alloc_basic2.phpt b/ext/ftp/tests/ftp_alloc_basic2.phpt new file mode 100755 index 0000000000..b9e4253fe8 --- /dev/null +++ b/ext/ftp/tests/ftp_alloc_basic2.phpt @@ -0,0 +1,23 @@ +--TEST-- +Testing ftp_alloc returns true +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +if (!$ftp) die("Couldn't connect to the server"); +ftp_login($ftp, 'user', 'pass'); + +var_dump(ftp_alloc($ftp, 1024, $result)); +var_dump($result); +?> +--EXPECT-- +bool(true) +string(20) "1024 bytes allocated"
\ No newline at end of file diff --git a/ext/ftp/tests/ftp_chmod_basic.phpt b/ext/ftp/tests/ftp_chmod_basic.phpt new file mode 100755 index 0000000000..baaa25a987 --- /dev/null +++ b/ext/ftp/tests/ftp_chmod_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_chmod returns file mode +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +if (!$ftp) die("Couldn't connect to the server"); +ftp_login($ftp, 'user', 'pass'); + +var_dump(ftp_chmod($ftp, 0644, 'test.txt')); +?> +--EXPECT-- +int(420) diff --git a/ext/ftp/tests/ftp_exec_basic.phpt b/ext/ftp/tests/ftp_exec_basic.phpt new file mode 100755 index 0000000000..4a1f63e388 --- /dev/null +++ b/ext/ftp/tests/ftp_exec_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_exec returns true +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +var_dump(ftp_exec($ftp, 'ls -al')); +?> +--EXPECT-- +bool(true)
\ No newline at end of file diff --git a/ext/ftp/tests/ftp_fget_basic1.phpt b/ext/ftp/tests/ftp_fget_basic1.phpt new file mode 100644 index 0000000000..475f7183d2 --- /dev/null +++ b/ext/ftp/tests/ftp_fget_basic1.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_fget ignore autoresume if autoseek is switched off +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); +ftp_set_option($ftp, FTP_AUTOSEEK, false); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$handle = fopen($local_file, 'w'); + +var_dump(ftp_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +bool(true) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_fget_basic2.phpt b/ext/ftp/tests/ftp_fget_basic2.phpt new file mode 100644 index 0000000000..00a26752d9 --- /dev/null +++ b/ext/ftp/tests/ftp_fget_basic2.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_fget autoresume +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +file_put_contents($local_file, 'ASCIIFoo'); +$handle = fopen($local_file, 'a'); + +var_dump(ftp_fget($ftp, $handle, 'fgetresume.txt', FTP_ASCII, FTP_AUTORESUME)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +bool(true) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_fget_basic3.phpt b/ext/ftp/tests/ftp_fget_basic3.phpt new file mode 100644 index 0000000000..b7098701ab --- /dev/null +++ b/ext/ftp/tests/ftp_fget_basic3.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_fget resume parameter +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +file_put_contents($local_file, 'ASCIIFoo'); +$handle = fopen($local_file, 'a'); + +var_dump(ftp_fget($ftp, $handle, 'fgetresume.txt', FTP_ASCII, 8)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +bool(true) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_nb_fget_basic1.phpt b/ext/ftp/tests/ftp_nb_fget_basic1.phpt new file mode 100644 index 0000000000..cac4eec56b --- /dev/null +++ b/ext/ftp/tests/ftp_nb_fget_basic1.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_nb_fget ignore autoresume if autoseek is switched off +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); +ftp_set_option($ftp, FTP_AUTOSEEK, false); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$handle = fopen($local_file, 'w'); + +var_dump(ftp_nb_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +int(2) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_nb_fget_basic2.phpt b/ext/ftp/tests/ftp_nb_fget_basic2.phpt new file mode 100644 index 0000000000..dc92f4e23b --- /dev/null +++ b/ext/ftp/tests/ftp_nb_fget_basic2.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_nb_fget autoresume +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +file_put_contents($local_file, 'ASCIIFoo'); +$handle = fopen($local_file, 'a'); + +var_dump(ftp_nb_fget($ftp, $handle, 'fgetresume.txt', FTP_ASCII, FTP_AUTORESUME)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +int(2) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_nb_fget_basic3.phpt b/ext/ftp/tests/ftp_nb_fget_basic3.phpt new file mode 100644 index 0000000000..d1a87c4f3d --- /dev/null +++ b/ext/ftp/tests/ftp_nb_fget_basic3.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_nb_fget resume parameter +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +file_put_contents($local_file, 'ASCIIFoo'); +$handle = fopen($local_file, 'a'); + +var_dump(ftp_nb_fget($ftp, $handle, 'fgetresume.txt', FTP_ASCII, 8)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +int(2) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_rawlist_basic2.phpt b/ext/ftp/tests/ftp_rawlist_basic2.phpt new file mode 100644 index 0000000000..1d93643429 --- /dev/null +++ b/ext/ftp/tests/ftp_rawlist_basic2.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_rawlist returns false on server error +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +var_dump(ftp_rawlist($ftp, 'no_exists/')); +?> +--EXPECT-- +bool(false)
\ No newline at end of file diff --git a/ext/ftp/tests/ftp_rmdir_basic.phpt b/ext/ftp/tests/ftp_rmdir_basic.phpt new file mode 100755 index 0000000000..6626cb4bed --- /dev/null +++ b/ext/ftp/tests/ftp_rmdir_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_rmdir returns true +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +if (!$ftp) die("Couldn't connect to the server"); +ftp_login($ftp, 'user', 'pass'); + +var_dump(ftp_rmdir($ftp, 'www/')); +?> +--EXPECT-- +bool(true)
\ No newline at end of file diff --git a/ext/posix/tests/posix_seteuid_variation3.phpt b/ext/posix/tests/posix_seteuid_variation3.phpt new file mode 100644 index 0000000000..70c05c86eb --- /dev/null +++ b/ext/posix/tests/posix_seteuid_variation3.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test function posix_seteuid() by substituting argument 1 with emptyUnsetUndefNull values. +--SKIPIF-- +<?php + if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; +?> +--CREDITS-- +Marco Fabbri mrfabbri@gmail.com +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- +<?php + + +echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n"; + + + +$unset_var = 10; +unset($unset_var); + +$variation_array = array( + 'unset var' => @$unset_var, + 'undefined var' => @$undefined_var, + 'empty string DQ' => "", + 'empty string SQ' => '', + 'uppercase NULL' => NULL, + 'lowercase null' => null, + ); + + +foreach ( $variation_array as $var ) { + var_dump(posix_seteuid( $var ) ); +} +?> +--EXPECTF-- +*** Test substituting argument 1 with emptyUnsetUndefNull values *** +bool(false) +bool(false) + +Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 22 +bool(false) + +Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 22 +bool(false) +bool(false) +bool(false) diff --git a/ext/posix/tests/posix_seteuid_variation6.phpt b/ext/posix/tests/posix_seteuid_variation6.phpt new file mode 100644 index 0000000000..65ff56be06 --- /dev/null +++ b/ext/posix/tests/posix_seteuid_variation6.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test function posix_seteuid() by substituting argument 1 with string values. +--SKIPIF-- +<?php + if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; +?> +--CREDITS-- +Marco Fabbri mrfabbri@gmail.com +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- +<?php + + +echo "*** Test substituting argument 1 with string values ***\n"; + + + +$heredoc = <<<EOT +hello world +EOT; + +$variation_array = array( + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + ); + + +foreach ( $variation_array as $var ) { + var_dump(posix_seteuid( $var ) ); +} +?> +--EXPECTF-- +*** Test substituting argument 1 with string values *** + +Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 21 +bool(false) + +Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 21 +bool(false) + +Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 21 +bool(false) + +Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 21 +bool(false) diff --git a/ext/posix/tests/posix_setgid_variation3.phpt b/ext/posix/tests/posix_setgid_variation3.phpt new file mode 100644 index 0000000000..5855746f01 --- /dev/null +++ b/ext/posix/tests/posix_setgid_variation3.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test function posix_setgid() by substituting argument 1 with emptyUnsetUndefNull values. +--CREDITS-- +Marco Fabbri mrfabbri@gmail.com +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--SKIPIF-- +<?php + if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; +?> +--FILE-- +<?php + + +echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n"; + + + +$unset_var = 10; +unset($unset_var); + +$variation_array = array( + 'unset var' => @$unset_var, + 'undefined var' => @$undefined_var, + 'empty string DQ' => "", + 'empty string SQ' => '', + 'uppercase NULL' => NULL, + 'lowercase null' => null, + ); + + +foreach ( $variation_array as $var ) { + var_dump(posix_setgid( $var ) ); +} +?> +--EXPECTF-- +*** Test substituting argument 1 with emptyUnsetUndefNull values *** +bool(false) +bool(false) + +Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d +bool(false) + +Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d +bool(false) +bool(false) +bool(false) diff --git a/ext/posix/tests/posix_setgid_variation7.phpt b/ext/posix/tests/posix_setgid_variation7.phpt new file mode 100644 index 0000000000..f8083c38f1 --- /dev/null +++ b/ext/posix/tests/posix_setgid_variation7.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test function posix_setgid() by substituting argument 1 with string values. +--CREDITS-- +Marco Fabbri mrfabbri@gmail.com +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--SKIPIF-- +<?php + if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; +?> +--FILE-- +<?php + + +echo "*** Test substituting argument 1 with string values ***\n"; + + + +$heredoc = <<<EOT +hello world +EOT; + +$variation_array = array( + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + ); + + +foreach ( $variation_array as $var ) { + var_dump(posix_setgid( $var ) ); +} +?> +--EXPECTF-- +*** Test substituting argument 1 with string values *** + +Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d +bool(false) + +Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d +bool(false) + +Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d +bool(false) + +Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d +bool(false) diff --git a/ext/posix/tests/posix_setuid_variation3.phpt b/ext/posix/tests/posix_setuid_variation3.phpt new file mode 100644 index 0000000000..1630cd1d0e --- /dev/null +++ b/ext/posix/tests/posix_setuid_variation3.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test function posix_setuid() by substituting argument 1 with emptyUnsetUndefNull values. +--SKIPIF-- +<?php + if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; +?> +--CREDITS-- +Marco Fabbri mrfabbri@gmail.com +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- +<?php + + +echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n"; + + + +$unset_var = 10; +unset($unset_var); + +$variation_array = array( + 'unset var' => @$unset_var, + 'undefined var' => @$undefined_var, + 'empty string DQ' => "", + 'empty string SQ' => '', + 'uppercase NULL' => NULL, + 'lowercase null' => null, + ); + + +foreach ( $variation_array as $var ) { + var_dump(posix_setuid( $var ) ); +} +?> +--EXPECTF-- +*** Test substituting argument 1 with emptyUnsetUndefNull values *** +bool(false) +bool(false) + +Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 22 +bool(false) + +Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 22 +bool(false) +bool(false) +bool(false) diff --git a/ext/posix/tests/posix_setuid_variation6.phpt b/ext/posix/tests/posix_setuid_variation6.phpt new file mode 100644 index 0000000000..79e614fec3 --- /dev/null +++ b/ext/posix/tests/posix_setuid_variation6.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test function posix_setuid() by substituting argument 1 with string values. +--SKIPIF-- +<?php + if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; +?> +--CREDITS-- +Marco Fabbri mrfabbri@gmail.com +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- +<?php + + +echo "*** Test substituting argument 1 with string values ***\n"; + + + +$heredoc = <<<EOT +hello world +EOT; + +$variation_array = array( + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + ); + + +foreach ( $variation_array as $var ) { + var_dump(posix_setuid( $var ) ); +} +?> +--EXPECTF-- +*** Test substituting argument 1 with string values *** + +Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 21 +bool(false) + +Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 21 +bool(false) + +Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 21 +bool(false) + +Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 21 +bool(false) diff --git a/ext/reflection/tests/ReflectionFunction_isDeprecated_basic.phpt b/ext/reflection/tests/ReflectionFunction_isDeprecated_basic.phpt new file mode 100644 index 0000000000..31d37a85f1 --- /dev/null +++ b/ext/reflection/tests/ReflectionFunction_isDeprecated_basic.phpt @@ -0,0 +1,15 @@ +--TEST-- +ReflectionFunction::isDeprecated +--CREDITS-- +Stefan Koopmanschap <stefan@phpgg.nl> +TestFest PHP|Tek +--SKIPIF-- +<?php +if (!extension_loaded('reflection') || !defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300) print 'skip'; +?> +--FILE-- +<?php +$rc = new ReflectionFunction('ereg'); +echo var_dump($rc->isDeprecated()); +--EXPECTF-- +bool(true) diff --git a/ext/sockets/tests/bug46360.phpt b/ext/sockets/tests/bug46360.phpt new file mode 100644 index 0000000000..c725a82f9a --- /dev/null +++ b/ext/sockets/tests/bug46360.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug 46360 - TCP_NODELAY constant (sock_get_option, sock_set_option) +--CREDITS-- +Florian Anderiasch +fa@php.net +--SKIPIF-- +<?php + if (version_compare(phpversion(), '5.2.7', '<')) { + die('skip old php, not eligible'); + } +?> +--FILE-- +<?php + var_dump('TCP_NODELAY'); +?> +--EXPECT-- +string(11) "TCP_NODELAY" diff --git a/ext/standard/tests/file/file_get_contents_basic001.phpt b/ext/standard/tests/file/file_get_contents_basic001.phpt new file mode 100644 index 0000000000..71b69634d2 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_basic001.phpt @@ -0,0 +1,21 @@ +--TEST-- +file_get_contents() test using basic syntax +--CREDITS-- +"Blanche V.N." <valerie_nare@yahoo.fr> +--FILE-- +<?php + $file_content = "Bienvenue au CodeFest a Montreal"; + $temp_filename = dirname(__FILE__)."/fichier_a_lire.txt"; + $handle = fopen($temp_filename,"w"); + fwrite($handle,$file_content); + fclose($handle); + $var = file_get_contents($temp_filename); + echo $var; +?> +--CLEAN-- +<?php + $temp_filename = dirname(__FILE__)."/fichier_a_lire.txt"; + unlink($temp_filename); +?> +--EXPECT-- +Bienvenue au CodeFest a Montreal diff --git a/ext/standard/tests/general_functions/get_cfg_var_basic.phpt b/ext/standard/tests/general_functions/get_cfg_var_basic.phpt new file mode 100644 index 0000000000..3fb0056553 --- /dev/null +++ b/ext/standard/tests/general_functions/get_cfg_var_basic.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test function get_cfg_var() by calling it with its expected arguments +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--INI-- +session.use_cookies=0 +session.serialize_handler=php +session.save_handler=files +--FILE-- +<?php + + +echo "*** Test by calling method or function with its expected arguments ***\n"; +var_dump(get_cfg_var( 'session.use_cookies' ) ); +var_dump(get_cfg_var( 'session.serialize_handler' ) ); +var_dump(get_cfg_var( 'session.save_handler' ) ); + +?> +--EXPECTF-- +*** Test by calling method or function with its expected arguments *** +string(1) "0" +string(3) "php" +string(5) "files" diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation9.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation9.phpt new file mode 100644 index 0000000000..6e0ffc51f0 --- /dev/null +++ b/ext/standard/tests/general_functions/get_cfg_var_variation9.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test function get_cfg_var() by substituting argument with array of valid parameters. +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--INI-- +session.use_cookies=0 +session.serialize_handler=php +session.save_handler=files +--FILE-- +<?php + + +echo "*** Test substituting argument with array of valid parameters ***\n"; + + + +$heredoc = <<<EOT +hello world +EOT; + +$variation_array = array( + 'session.use_cookies', + 'session.serialize_handler', + 'session.save_handler' + ); + + +foreach ( $variation_array as $var ) { + var_dump(get_cfg_var( $var ) ); +} +?> +--EXPECTF-- +*** Test substituting argument with array of valid parameters *** +string(1) "0" +string(3) "php" +string(5) "files" diff --git a/ext/standard/tests/general_functions/proc_nice_variation3.phpt b/ext/standard/tests/general_functions/proc_nice_variation3.phpt new file mode 100644 index 0000000000..458126db4a --- /dev/null +++ b/ext/standard/tests/general_functions/proc_nice_variation3.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test function proc_nice() by substituting argument 1 with emptyUnsetUndefNull values. +--CREDITS-- +Italian PHP TestFest 2009 Cesena 19-20-21 june +Fabio Fabbrucci (fabbrucci@grupporetina.com) +Michele Orselli (mo@ideato.it) +Simone Gentili (sensorario@gmail.com) +--FILE-- +<?php + + +echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n"; + + + +$unset_var = 10; +unset($unset_var); + +$variation_array = array( + 'unset var' => @$unset_var, + 'undefined var' => @$undefined_var, + 'empty string DQ' => "", + 'empty string SQ' => '', + 'uppercase NULL' => NULL, + 'lowercase null' => null, + ); + + +foreach ( $variation_array as $var ) { + var_dump(proc_nice( $var ) ); +} +?> +--EXPECTF-- +*** Test substituting argument 1 with emptyUnsetUndefNull values *** +bool(true) +bool(true) + +Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d +bool(false) + +Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d +bool(false) +bool(true) +bool(true) diff --git a/ext/standard/tests/general_functions/proc_nice_variation7.phpt b/ext/standard/tests/general_functions/proc_nice_variation7.phpt new file mode 100644 index 0000000000..70487dd09d --- /dev/null +++ b/ext/standard/tests/general_functions/proc_nice_variation7.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test function proc_nice() by substituting argument 1 with string values. +--CREDITS-- +Italian PHP TestFest 2009 Cesena 19-20-21 june +Fabio Fabbrucci (fabbrucci@grupporetina.com) +Michele Orselli (mo@ideato.it) +Simone Gentili (sensorario@gmail.com) +--FILE-- +<?php + + +echo "*** Test substituting argument 1 with string values ***\n"; + + + +$heredoc = <<<EOT +hello world +EOT; + +$variation_array = array( + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + ); + + +foreach ( $variation_array as $var ) { + var_dump(proc_nice( $var ) ); +} +?> +--EXPECTF-- +*** Test substituting argument 1 with string values *** + +Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d +bool(false) + +Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d +bool(false) + +Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d +bool(false) + +Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d +bool(false) diff --git a/ext/standard/tests/misc/time_sleep_until_error2.phpt b/ext/standard/tests/misc/time_sleep_until_error2.phpt new file mode 100644 index 0000000000..311dd72f6b --- /dev/null +++ b/ext/standard/tests/misc/time_sleep_until_error2.phpt @@ -0,0 +1,12 @@ +--TEST-- +time_sleep_until() function - error test for time_sleep_until() +--CREDITS-- +Filippo De Santis fd@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- +<?php + var_dump(time_sleep_until('goofy')); +?> +--EXPECTF-- +Warning: time_sleep_until() expects parameter 1 to be double, string given in %s on line 2 +NULL diff --git a/ext/standard/tests/url/get_headers_error_002.phpt b/ext/standard/tests/url/get_headers_error_002.phpt new file mode 100644 index 0000000000..9626211cfc --- /dev/null +++ b/ext/standard/tests/url/get_headers_error_002.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test get_headers() function: wrong type for argument format +--CREDITS-- +June Henriksen <juneih@redpill-linpro.com> +#PHPTestFest2009 Norway 2009-06-09 \o/ +--FILE-- +<?php +/* Prototype : proto array get_headers(string url[, int format]) + * Description: Fetches all the headers sent by the server in response to a HTTP request + * Source code: ext/standard/url.c + * Alias to functions: + */ + +echo "*** Testing get_headers() : error conditions ***\n"; +$url = 'http://php.net'; + +// Format argument as type String +echo "\n-- Testing get_headers() function with format argument as type string --\n"; +var_dump( get_headers($url, "#PHPTestFest2009 Norway") ); + +// Format argument as type Array +echo "\n-- Testing get_headers() function with format argument as type array --\n"; +var_dump( get_headers($url, array()) ); + +// Format argument as type Object +class testObject +{ +} + +$object = new testObject(); +echo "\n-- Testing get_headers() function with format argument as type object --\n"; +var_dump( get_headers($url, $object) ); + + +echo "Done" +?> +--EXPECTF-- +*** Testing get_headers() : error conditions *** + +-- Testing get_headers() function with format argument as type string -- + +Warning: get_headers() expects parameter 2 to be long, string given in %s on line 13 +NULL + +-- Testing get_headers() function with format argument as type array -- + +Warning: get_headers() expects parameter 2 to be long, array given in %s on line 17 +NULL + +-- Testing get_headers() function with format argument as type object -- + +Warning: get_headers() expects parameter 2 to be long, object given in %s on line 26 +NULL +Done + diff --git a/tests/basic/bug45986.phpt b/tests/basic/bug45986.phpt new file mode 100644 index 0000000000..5745d272c4 --- /dev/null +++ b/tests/basic/bug45986.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #45986 (wrong error messag for a non existant file on rename) +--CREDITS-- +Sebastian Schürmann +sebs@php.net +Testfest 2009 Munich +--FILE-- +<?php +rename('foo', 'bar'); +?> +--EXPECTREGEX-- +.*No such.* diff --git a/tests/func/time_sleep_until_basic.phpt b/tests/func/time_sleep_until_basic.phpt deleted file mode 100644 index def114cc48..0000000000 --- a/tests/func/time_sleep_until_basic.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -time_sleep_until — Make the script sleep until the specified time ---CREDITS-- -Àlex Corretgé - alex@corretge.cat ---FILE-- -<?php - -$timeA = time(); -time_sleep_until($timeA+3); -$timeB = time(); -echo ($timeB - $timeA) . " seconds."; - -?> ---EXPECT-- -3 seconds.
\ No newline at end of file diff --git a/tests/func/time_sleep_until_error2.phpt b/tests/func/time_sleep_until_error2.phpt deleted file mode 100644 index bb999b9bef..0000000000 --- a/tests/func/time_sleep_until_error2.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -time_sleep_until — Make the script sleep until the specified time ---CREDITS-- -Àlex Corretgé - alex@corretge.cat ---FILE-- -<?php - -$timeA = time(); -time_sleep_until($timeA-3); -$timeB = time(); -echo ($timeB - $timeA) . " seconds."; - -?> ---EXPECTF-- -Warning: time_sleep_until(): Sleep until to time is less than current time in %s.php on line %d -0 seconds.
\ No newline at end of file diff --git a/tests/lang/bug44827.phpt b/tests/lang/bug44827.phpt new file mode 100644 index 0000000000..38e1d45691 --- /dev/null +++ b/tests/lang/bug44827.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #44827 (Class error when trying to access :: as constant) +--CREDITS-- +Sebastian Schürmann +sebs@php.net +Testfest Munich 2009 +--FILE-- +<?php +define('::', true); +var_dump(constant('::')); +?> +--EXPECTREGEX-- +.*Fatal.* + |