mirror of
https://github.com/php/php-src.git
synced 2025-01-10 13:03:54 +08:00
The last of the 2009 testfest tests
This commit is contained in:
parent
61de1cbf1f
commit
36a338a569
16
ext/date/tests/cal_days_in_month_invalid_calendar.phpt
Normal file
16
ext/date/tests/cal_days_in_month_invalid_calendar.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
cal_days_in_month: test invalid parameter
|
||||
--CREDITS--
|
||||
Havard Eide <nucleuz@gmail.com>
|
||||
#PHPTestFest2009 Norway 2009-06-09 \o/
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("calendar")) { echo "skip extension not available"; } ?>
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
echo cal_days_in_month(99,0, 2009);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: cal_days_in_month(): invalid calendar ID 99 in %s on line %d
|
||||
|
16
ext/date/tests/cal_days_in_month_invalid_date.phpt
Normal file
16
ext/date/tests/cal_days_in_month_invalid_date.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
cal_days_in_month: test invalid parameter
|
||||
--CREDITS--
|
||||
Havard Eide <nucleuz@gmail.com>
|
||||
#PHPTestFest2009 Norway 2009-06-09 \o/
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("calendar")) { echo "skip extension not available"; } ?>
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
echo cal_days_in_month(CAL_GREGORIAN,0, 2009);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: cal_days_in_month(): invalid date in %s on line %d
|
||||
|
59
ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
Normal file
59
ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
Normal file
@ -0,0 +1,59 @@
|
||||
--TEST--
|
||||
DomDocument::$strictErrorChecking - ensure turning off actually works
|
||||
--CREDITS--
|
||||
Vincent Tsao <notes4vincent@gmail.com>
|
||||
(and Dan Convissor)
|
||||
# TestFest 2009 NYPHP
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo "Load document\n";
|
||||
$doc = new DOMDocument;
|
||||
$doc->load(dirname(__FILE__)."/book.xml");
|
||||
|
||||
echo "See if strictErrorChecking is on\n";
|
||||
var_dump($doc->strictErrorChecking);
|
||||
|
||||
echo "Should throw DOMException when strictErrorChecking is on\n";
|
||||
try {
|
||||
$attr = $doc->createAttribute(0);
|
||||
} catch (DOMException $e) {
|
||||
echo "GOOD. DOMException thrown\n";
|
||||
echo $e->getMessage() ."\n";
|
||||
} catch (Exception $e) {
|
||||
echo "OOPS. Other exception thrown\n";
|
||||
}
|
||||
|
||||
|
||||
echo "Turn strictErrorChecking off\n";
|
||||
$doc->strictErrorChecking = false;
|
||||
|
||||
echo "See if strictErrorChecking is off\n";
|
||||
var_dump($doc->strictErrorChecking);
|
||||
|
||||
echo "Should raise PHP error because strictErrorChecking is off\n";
|
||||
try {
|
||||
$attr = $doc->createAttribute(0);
|
||||
} catch (DOMException $e) {
|
||||
echo "OOPS. DOMException thrown\n";
|
||||
echo $e->getMessage() ."\n";
|
||||
} catch (Exception $e) {
|
||||
echo "OOPS. Other exception thrown\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Load document
|
||||
See if strictErrorChecking is on
|
||||
bool(true)
|
||||
Should throw DOMException when strictErrorChecking is on
|
||||
GOOD. DOMException thrown
|
||||
Invalid Character Error
|
||||
Turn strictErrorChecking off
|
||||
See if strictErrorChecking is off
|
||||
bool(false)
|
||||
Should raise PHP error because strictErrorChecking is off
|
||||
|
||||
Warning: DOMDocument::createAttribute(): Invalid Character Error in %sDOMDocument_strictErrorChecking_variation.php on line %d
|
16
ext/mbstring/tests/bug46806.phpt
Normal file
16
ext/mbstring/tests/bug46806.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #46806 (mb_wtrimwidth cutting to early)
|
||||
--CREDITS--
|
||||
Sebastian Schürmann
|
||||
sebs@php.net
|
||||
Testfest 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mbstring")) die("skip mbstring is not available"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo mb_strimwidth('helloworld', 0, 5, '...', 'UTF-8') . "\n";
|
||||
echo mb_strimwidth('hello', 0, 5, '...', 'UTF-8');
|
||||
?>
|
||||
--EXPECT--
|
||||
he...
|
||||
hello
|
18
ext/reflection/tests/ReflectionFunction_isClosure_basic.phpt
Normal file
18
ext/reflection/tests/ReflectionFunction_isClosure_basic.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Reflection::isClosure
|
||||
--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
|
||||
$closure = function($param) { return "this is a closure"; };
|
||||
$rc = new ReflectionFunction($closure);
|
||||
echo var_dump($rc->isClosure());
|
||||
--EXPECTF--
|
||||
bool(true)
|
59
ext/sockets/tests/socket_getpeername_ipv6loop.phpt
Normal file
59
ext/sockets/tests/socket_getpeername_ipv6loop.phpt
Normal file
@ -0,0 +1,59 @@
|
||||
--TEST--
|
||||
ext/sockets - socket_getpeername_ipv6loop - basic test
|
||||
--CREDITS--
|
||||
# TestFest 2009 - NorwayUG
|
||||
# $Id: socket_getpeername_ipv6loop.phpt 494 2009-06-09 20:38:05Z tatjana.andersen@redpill-linpro.com $
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Bind and connect sockets to localhost */
|
||||
$localhost = '::1';
|
||||
|
||||
/* Hold the port associated to address */
|
||||
$port = 31337;
|
||||
|
||||
/* Setup socket server */
|
||||
$server = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
|
||||
if (!$server) {
|
||||
die('Unable to create AF_INET6 socket [server]');
|
||||
}
|
||||
|
||||
if (!socket_bind($server, $localhost, $port)) {
|
||||
die('Unable to bind to '.$localhost.':'.$port);
|
||||
}
|
||||
if (!socket_listen($server, 2)) {
|
||||
die('Unable to listen on socket');
|
||||
}
|
||||
|
||||
/* Connect to it */
|
||||
$client = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
|
||||
if (!$client) {
|
||||
die('Unable to create AF_INET6 socket [client]');
|
||||
}
|
||||
if (!socket_connect($client, $localhost, $port)) {
|
||||
die('Unable to connect to server socket');
|
||||
}
|
||||
|
||||
/* Accept that connection */
|
||||
$socket = socket_accept($server);
|
||||
if (!$socket) {
|
||||
die('Unable to accept connection');
|
||||
}
|
||||
|
||||
if (!socket_getpeername($client, $address, $port)) {
|
||||
die('Unable to retrieve peer name');
|
||||
}
|
||||
var_dump($address, $port);
|
||||
|
||||
socket_close($client);
|
||||
socket_close($socket);
|
||||
socket_close($server);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "::1"
|
||||
int(31337)
|
154
ext/sockets/tests/socket_strerror.phpt
Normal file
154
ext/sockets/tests/socket_strerror.phpt
Normal file
@ -0,0 +1,154 @@
|
||||
--TEST--
|
||||
ext/sockets - socket_strerror - basic test
|
||||
--CREDITS--
|
||||
Florian Anderiasch
|
||||
fa@php.net
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s_s = socket_strerror();
|
||||
for ($i=0;$i<=132;$i++) {
|
||||
var_dump(socket_strerror($i));
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Warning: socket_strerror() expects exactly 1 parameter, 0 given in %s on line %i
|
||||
string(7) "Success"
|
||||
string(23) "Operation not permitted"
|
||||
string(25) "No such file or directory"
|
||||
string(15) "No such process"
|
||||
string(23) "Interrupted system call"
|
||||
string(18) "Input/output error"
|
||||
string(25) "No such device or address"
|
||||
string(22) "Argument list too long"
|
||||
string(17) "Exec format error"
|
||||
string(19) "Bad file descriptor"
|
||||
string(18) "No child processes"
|
||||
string(32) "Resource temporarily unavailable"
|
||||
string(22) "Cannot allocate memory"
|
||||
string(17) "Permission denied"
|
||||
string(11) "Bad address"
|
||||
string(21) "Block device required"
|
||||
string(23) "Device or resource busy"
|
||||
string(11) "File exists"
|
||||
string(25) "Invalid cross-device link"
|
||||
string(14) "No such device"
|
||||
string(15) "Not a directory"
|
||||
string(14) "Is a directory"
|
||||
string(16) "Invalid argument"
|
||||
string(29) "Too many open files in system"
|
||||
string(19) "Too many open files"
|
||||
string(30) "Inappropriate ioctl for device"
|
||||
string(14) "Text file busy"
|
||||
string(14) "File too large"
|
||||
string(23) "No space left on device"
|
||||
string(12) "Illegal seek"
|
||||
string(21) "Read-only file system"
|
||||
string(14) "Too many links"
|
||||
string(11) "Broken pipe"
|
||||
string(32) "Numerical argument out of domain"
|
||||
string(29) "Numerical result out of range"
|
||||
string(25) "Resource deadlock avoided"
|
||||
string(18) "File name too long"
|
||||
string(18) "No locks available"
|
||||
string(24) "Function not implemented"
|
||||
string(19) "Directory not empty"
|
||||
string(33) "Too many levels of symbolic links"
|
||||
string(16) "Unknown error 41"
|
||||
string(26) "No message of desired type"
|
||||
string(18) "Identifier removed"
|
||||
string(27) "Channel number out of range"
|
||||
string(24) "Level 2 not synchronized"
|
||||
string(14) "Level 3 halted"
|
||||
string(13) "Level 3 reset"
|
||||
string(24) "Link number out of range"
|
||||
string(28) "Protocol driver not attached"
|
||||
string(26) "No CSI structure available"
|
||||
string(14) "Level 2 halted"
|
||||
string(16) "Invalid exchange"
|
||||
string(26) "Invalid request descriptor"
|
||||
string(13) "Exchange full"
|
||||
string(8) "No anode"
|
||||
string(20) "Invalid request code"
|
||||
string(12) "Invalid slot"
|
||||
string(16) "Unknown error 58"
|
||||
string(20) "Bad font file format"
|
||||
string(19) "Device not a stream"
|
||||
string(17) "No data available"
|
||||
string(13) "Timer expired"
|
||||
string(24) "Out of streams resources"
|
||||
string(29) "Machine is not on the network"
|
||||
string(21) "Package not installed"
|
||||
string(16) "Object is remote"
|
||||
string(21) "Link has been severed"
|
||||
string(15) "Advertise error"
|
||||
string(13) "Srmount error"
|
||||
string(27) "Communication error on send"
|
||||
string(14) "Protocol error"
|
||||
string(18) "Multihop attempted"
|
||||
string(18) "RFS specific error"
|
||||
string(11) "Bad message"
|
||||
string(37) "Value too large for defined data type"
|
||||
string(26) "Name not unique on network"
|
||||
string(28) "File descriptor in bad state"
|
||||
string(22) "Remote address changed"
|
||||
string(38) "Can not access a needed shared library"
|
||||
string(36) "Accessing a corrupted shared library"
|
||||
string(31) ".lib section in a.out corrupted"
|
||||
string(47) "Attempting to link in too many shared libraries"
|
||||
string(37) "Cannot exec a shared library directly"
|
||||
string(49) "Invalid or incomplete multibyte or wide character"
|
||||
string(43) "Interrupted system call should be restarted"
|
||||
string(18) "Streams pipe error"
|
||||
string(14) "Too many users"
|
||||
string(30) "Socket operation on non-socket"
|
||||
string(28) "Destination address required"
|
||||
string(16) "Message too long"
|
||||
string(30) "Protocol wrong type for socket"
|
||||
string(22) "Protocol not available"
|
||||
string(22) "Protocol not supported"
|
||||
string(25) "Socket type not supported"
|
||||
string(23) "Operation not supported"
|
||||
string(29) "Protocol family not supported"
|
||||
string(40) "Address family not supported by protocol"
|
||||
string(22) "Address already in use"
|
||||
string(31) "Cannot assign requested address"
|
||||
string(15) "Network is down"
|
||||
string(22) "Network is unreachable"
|
||||
string(35) "Network dropped connection on reset"
|
||||
string(32) "Software caused connection abort"
|
||||
string(24) "Connection reset by peer"
|
||||
string(25) "No buffer space available"
|
||||
string(39) "Transport endpoint is already connected"
|
||||
string(35) "Transport endpoint is not connected"
|
||||
string(45) "Cannot send after transport endpoint shutdown"
|
||||
string(34) "Too many references: cannot splice"
|
||||
string(20) "Connection timed out"
|
||||
string(18) "Connection refused"
|
||||
string(12) "Host is down"
|
||||
string(16) "No route to host"
|
||||
string(29) "Operation already in progress"
|
||||
string(25) "Operation now in progress"
|
||||
string(21) "Stale NFS file handle"
|
||||
string(24) "Structure needs cleaning"
|
||||
string(27) "Not a XENIX named type file"
|
||||
string(29) "No XENIX semaphores available"
|
||||
string(20) "Is a named type file"
|
||||
string(16) "Remote I/O error"
|
||||
string(19) "Disk quota exceeded"
|
||||
string(15) "No medium found"
|
||||
string(17) "Wrong medium type"
|
||||
string(18) "Operation canceled"
|
||||
string(26) "Required key not available"
|
||||
string(15) "Key has expired"
|
||||
string(20) "Key has been revoked"
|
||||
string(27) "Key was rejected by service"
|
||||
string(10) "Owner died"
|
||||
string(21) "State not recoverable"
|
||||
string(17) "Unknown error 132"
|
16
ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
Normal file
16
ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
ArrayObject: test that you cannot unserialize a empty string
|
||||
--CREDITS--
|
||||
Havard Eide <nucleuz@gmail.com>
|
||||
#PHPTestFest2009 Norway 2009-06-09 \o/
|
||||
--FILE--
|
||||
<?php
|
||||
$a = new ArrayObject(array());
|
||||
$a->unserialize("");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty serialized string cannot be empty' in %s.php:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): ArrayObject->unserialize('')
|
||||
#1 {main}
|
||||
thrown in %s.php on line %d
|
29
ext/spl/tests/DirectoryIterator_getInode_basic.phpt
Normal file
29
ext/spl/tests/DirectoryIterator_getInode_basic.phpt
Normal file
@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
SPL: Spl Directory Iterator test getInode
|
||||
--CREDITS--
|
||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||
Andrea Giorgini <agiorg@gmail.com>
|
||||
Filippo De Santis <fd@ideato.it>
|
||||
Daniel Londero <daniel.londero@gmail.com>
|
||||
Francesco Trucchia <ft@ideato.it>
|
||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//file
|
||||
mkdir('test_dir_ptfi');
|
||||
$dirIterator = new DirectoryIterator('test_dir_ptfi');
|
||||
var_dump(decoct($dirIterator->getInode()));
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
rmdir('test_dir_ptfi');
|
||||
?>
|
||||
--EXPECTF--
|
||||
unicode(%d) "%d"
|
36
ext/standard/tests/file/lchgrp_basic.phpt
Normal file
36
ext/standard/tests/file/lchgrp_basic.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Test lchgrp() function : basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support');
|
||||
if (!function_exists("posix_getgid")) die("skip no posix_getgid()");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchgrp.txt';
|
||||
$symlink = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'symlink.txt';
|
||||
|
||||
$gid = posix_getgid();
|
||||
|
||||
var_dump( touch( $filename ) );
|
||||
var_dump( symlink( $filename, $symlink ) );
|
||||
var_dump( lchgrp( $filename, $gid ) );
|
||||
var_dump( filegroup( $symlink ) === $gid );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
|
||||
$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchgrp.txt';
|
||||
$symlink = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'symlink.txt';
|
||||
unlink($filename);
|
||||
unlink($symlink);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
===DONE===
|
28
ext/zip/tests/oo_getstatusstring.phpt
Normal file
28
ext/zip/tests/oo_getstatusstring.phpt
Normal file
@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
This test will test getStatusString method in ZipArchive
|
||||
--CREDITS--
|
||||
Ole-Petter Wikene <olepw@redpill-linpro.com>
|
||||
#PHPTestFest2009 Norway 2009-06-09 \o/
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("zip")) { echo "skip extension not available"; } ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dirname = dirname(__FILE__) . '/';
|
||||
$arch = new ZipArchive;
|
||||
$arch->open($dirname.'foo.zip',ZIPARCHIVE::CREATE);
|
||||
var_dump($arch->getStatusString());
|
||||
//delete an index that does not exist - trigger error
|
||||
$arch->deleteIndex(2);
|
||||
var_dump($arch->getStatusString());
|
||||
$arch->close();
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink($dirname.'foo.zip');
|
||||
?>
|
||||
--EXPECT--
|
||||
string(8) "No error"
|
||||
string(16) "Invalid argument"
|
||||
|
28
ext/zip/tests/zip_open_error.phpt
Normal file
28
ext/zip/tests/zip_open_error.phpt
Normal file
@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
zip_open() error conditions
|
||||
--CREDITS--
|
||||
Birgitte Kvarme <bitta@redpill-linpro.com>
|
||||
#PHPTestFest2009 Norway 2009-06-09 \o/
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('zip')) die('skip');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Test case 1:";
|
||||
$zip = zip_open("");
|
||||
|
||||
echo "Test case 2:";
|
||||
$zip = zip_open("i_dont_care_about_this_parameter", "this_is_one_to_many");
|
||||
|
||||
echo "Test case 3:\n";
|
||||
$zip = zip_open("/non_exisitng_directory/test_procedural.zip");
|
||||
echo is_resource($zip) ? "OK" : "Failure";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test case 1:
|
||||
Warning: zip_open(): Empty string as source in %s on line %d
|
||||
Test case 2:
|
||||
Warning: zip_open() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Test case 3:
|
||||
Failure
|
Loading…
Reference in New Issue
Block a user