More tests from 2009 testfest

This commit is contained in:
Zoe Slattery 2009-08-30 09:30:13 +00:00
parent 0ee945e727
commit d4ba889aa4
34 changed files with 1022 additions and 31 deletions

View File

@ -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:
unicode(34) "http://dom.example.org/example.xml"
Done

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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)

View File

@ -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
"

View File

@ -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
"

View File

@ -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
"

View File

@ -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
"

View File

@ -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
"

View File

@ -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
"

View File

@ -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)

View File

@ -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)

View File

@ -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, Unicode string given in %s on line 22
bool(false)
Warning: posix_seteuid() expects parameter 1 to be long, Unicode string given in %s on line 22
bool(false)
bool(false)
bool(false)

View File

@ -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, Unicode string given in %s on line 21
bool(false)
Warning: posix_seteuid() expects parameter 1 to be long, Unicode string given in %s on line 21
bool(false)
Warning: posix_seteuid() expects parameter 1 to be long, Unicode string given in %s on line 21
bool(false)
Warning: posix_seteuid() expects parameter 1 to be long, Unicode string given in %s on line 21
bool(false)

View File

@ -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, Unicode string given in %s on line %d
bool(false)
Warning: posix_setgid() expects parameter 1 to be long, Unicode string given in %s on line %d
bool(false)
bool(false)
bool(false)

View File

@ -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, Unicode string given in %s on line %d
bool(false)
Warning: posix_setgid() expects parameter 1 to be long, Unicode string given in %s on line %d
bool(false)
Warning: posix_setgid() expects parameter 1 to be long, Unicode string given in %s on line %d
bool(false)
Warning: posix_setgid() expects parameter 1 to be long, Unicode string given in %s on line %d
bool(false)

View File

@ -0,0 +1,51 @@
--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
--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_setuid( $var ) );
}
?>
--EXPECTF--
*** Test substituting argument 1 with emptyUnsetUndefNull values ***
bool(false)
bool(false)
Warning: posix_setuid() expects parameter 1 to be long, Unicode string given in %s on line 22
bool(false)
Warning: posix_setuid() expects parameter 1 to be long, Unicode string given in %s on line 22
bool(false)
bool(false)
bool(false)

View File

@ -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, Unicode string given in %s on line 21
bool(false)
Warning: posix_setuid() expects parameter 1 to be long, Unicode string given in %s on line 21
bool(false)
Warning: posix_setuid() expects parameter 1 to be long, Unicode string given in %s on line 21
bool(false)
Warning: posix_setuid() expects parameter 1 to be long, Unicode string given in %s on line 21
bool(false)

View File

@ -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)

View File

@ -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--
unicode(11) "TCP_NODELAY"

View File

@ -0,0 +1,22 @@
--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);
?>
--EXPECTF--
Notice: fwrite(): 32 character unicode buffer downcoded for binary stream runtime_encoding in %s.php on line %d
Bienvenue au CodeFest a Montreal

View File

@ -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 ***
unicode(1) "0"
unicode(3) "php"
unicode(5) "files"

View File

@ -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 ***
unicode(1) "0"
unicode(3) "php"
unicode(5) "files"

View File

@ -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, Unicode string given in %s on line %d
bool(false)
Warning: proc_nice() expects parameter 1 to be long, Unicode string given in %s on line %d
bool(false)
bool(true)
bool(true)

View File

@ -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, Unicode string given in %s on line %d
bool(false)
Warning: proc_nice() expects parameter 1 to be long, Unicode string given in %s on line %d
bool(false)
Warning: proc_nice() expects parameter 1 to be long, Unicode string given in %s on line %d
bool(false)
Warning: proc_nice() expects parameter 1 to be long, Unicode string given in %s on line %d
bool(false)

View File

@ -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, Unicode string given in %s on line 2
NULL

View File

@ -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, Unicode 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

12
tests/basic/bug45986.phpt Normal file
View File

@ -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.*

View File

@ -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.

View File

@ -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.

14
tests/lang/bug44827.phpt Normal file
View File

@ -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.*