mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
fix tests, add more
This commit is contained in:
parent
0d5a13ddda
commit
3000c0be66
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
comparing different variables for equality
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
comparing different variables for identity
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
comparing different variables (greater than)
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
comparing different variables (less than)
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
comparing different variables (greater or equal than)
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
comparing different variables (smaller or equal than)
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
decrementing different variables
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
20
Zend/tests/exception_handler_001.phpt
Normal file
20
Zend/tests/exception_handler_001.phpt
Normal file
@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
exception handler tests - 1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_exception_handler("foo");
|
||||
|
||||
function foo($e) {
|
||||
var_dump(get_class($e)." thrown!");
|
||||
}
|
||||
|
||||
class test extends Exception {
|
||||
}
|
||||
|
||||
throw new test();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(12) "test thrown!"
|
23
Zend/tests/exception_handler_002.phpt
Normal file
23
Zend/tests/exception_handler_002.phpt
Normal file
@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
exception handler tests - 2
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_exception_handler("foo");
|
||||
|
||||
function foo($e) {
|
||||
var_dump(get_class($e)." thrown!");
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
class test extends Exception {
|
||||
}
|
||||
|
||||
throw new test();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(12) "test thrown!"
|
||||
|
||||
Fatal error: Exception thrown without a stack frame in Unknown on line 0
|
24
Zend/tests/exception_handler_003.phpt
Normal file
24
Zend/tests/exception_handler_003.phpt
Normal file
@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
exception handler tests - 3
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class test {
|
||||
|
||||
function foo () {
|
||||
set_exception_handler(array($this, "bar"));
|
||||
}
|
||||
|
||||
function bar($e) {
|
||||
var_dump(get_class($e)." thrown!");
|
||||
}
|
||||
}
|
||||
|
||||
$a = new test;
|
||||
$a->foo();
|
||||
throw new Exception();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(17) "Exception thrown!"
|
21
Zend/tests/exception_handler_004.phpt
Normal file
21
Zend/tests/exception_handler_004.phpt
Normal file
@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
exception handler tests - 4
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_exception_handler("fo");
|
||||
set_exception_handler(array("", ""));
|
||||
set_exception_handler();
|
||||
set_exception_handler("foo", "bar");
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: set_exception_handler() expects the argument (fo) to be a valid callback in %s on line %d
|
||||
|
||||
Warning: set_exception_handler() expects the argument (::) to be a valid callback in %s on line %d
|
||||
|
||||
Warning: Wrong parameter count for set_exception_handler() in %s on line %d
|
||||
|
||||
Warning: Wrong parameter count for set_exception_handler() in %s on line %d
|
||||
Done
|
23
Zend/tests/exception_handler_005.phpt
Normal file
23
Zend/tests/exception_handler_005.phpt
Normal file
@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
exception handler tests - 5
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_exception_handler("foo");
|
||||
set_exception_handler("foo1");
|
||||
|
||||
function foo($e) {
|
||||
var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
|
||||
}
|
||||
|
||||
function foo1($e) {
|
||||
var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
|
||||
}
|
||||
|
||||
|
||||
throw new excEption();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(25) "foo1(): Exception thrown!"
|
25
Zend/tests/exception_handler_006.phpt
Normal file
25
Zend/tests/exception_handler_006.phpt
Normal file
@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
exception handler tests - 6
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_exception_handler("foo");
|
||||
set_exception_handler("foo1");
|
||||
|
||||
restore_exception_handler();
|
||||
|
||||
function foo($e) {
|
||||
var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
|
||||
}
|
||||
|
||||
function foo1($e) {
|
||||
var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
|
||||
}
|
||||
|
||||
|
||||
throw new excEption();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(24) "foo(): Exception thrown!"
|
Loading…
Reference in New Issue
Block a user