diff options
author | Antony Dovgal <tony2001@php.net> | 2007-04-27 21:32:40 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2007-04-27 21:32:40 +0000 |
commit | 8c8f7708e948ee5356301e6412420aa737308d93 (patch) | |
tree | 7d25289bd37c16ef4264df068fdf9fad917093fe /Zend/tests | |
parent | 35ba6cd0df9a25bf2eab9cea57e912229364ff36 (diff) | |
download | php-git-8c8f7708e948ee5356301e6412420aa737308d93.tar.gz |
add new tests
Diffstat (limited to 'Zend/tests')
-rw-r--r-- | Zend/tests/cast_to_array.phpt | bin | 0 -> 1539 bytes | |||
-rw-r--r-- | Zend/tests/cast_to_bool.phpt | 53 | ||||
-rw-r--r-- | Zend/tests/cast_to_double.phpt | 55 | ||||
-rw-r--r-- | Zend/tests/cast_to_int.phpt | 55 | ||||
-rw-r--r-- | Zend/tests/cast_to_object.phpt | bin | 0 -> 1844 bytes | |||
-rw-r--r-- | Zend/tests/cast_to_string.phpt | bin | 0 -> 980 bytes | |||
-rw-r--r-- | Zend/tests/settype_array.phpt | bin | 0 -> 1559 bytes | |||
-rw-r--r-- | Zend/tests/settype_bool.phpt | 53 | ||||
-rw-r--r-- | Zend/tests/settype_double.phpt | 55 | ||||
-rw-r--r-- | Zend/tests/settype_int.phpt | 55 | ||||
-rw-r--r-- | Zend/tests/settype_null.phpt | 53 | ||||
-rw-r--r-- | Zend/tests/settype_object.phpt | bin | 0 -> 1864 bytes | |||
-rw-r--r-- | Zend/tests/settype_resource.phpt | bin | 0 -> 2761 bytes | |||
-rw-r--r-- | Zend/tests/settype_string.phpt | bin | 0 -> 1106 bytes |
14 files changed, 379 insertions, 0 deletions
diff --git a/Zend/tests/cast_to_array.phpt b/Zend/tests/cast_to_array.phpt Binary files differnew file mode 100644 index 0000000000..5c59d916cf --- /dev/null +++ b/Zend/tests/cast_to_array.phpt diff --git a/Zend/tests/cast_to_bool.phpt b/Zend/tests/cast_to_bool.phpt new file mode 100644 index 0000000000..75ab09d1b5 --- /dev/null +++ b/Zend/tests/cast_to_bool.phpt @@ -0,0 +1,53 @@ +--TEST-- +casting different variables to boolean +--FILE-- +<?php + +$r = fopen(__FILE__, "r"); + +class test { + function __toString() { + return "10"; + } +} + +$o = new test; + +$vars = array( + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o +); + +foreach ($vars as $var) { + $tmp = (bool)$var; + var_dump($tmp); +} + +echo "Done\n"; +?> +--EXPECTF-- +bool(true) +bool(true) +bool(false) +bool(true) +bool(true) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(true) +Done diff --git a/Zend/tests/cast_to_double.phpt b/Zend/tests/cast_to_double.phpt new file mode 100644 index 0000000000..7afc2708be --- /dev/null +++ b/Zend/tests/cast_to_double.phpt @@ -0,0 +1,55 @@ +--TEST-- +casting different variables to double +--FILE-- +<?php + +$r = fopen(__FILE__, "r"); + +class test { + function __toString() { + return "10"; + } +} + +$o = new test; + +$vars = array( + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o +); + +foreach ($vars as $var) { + $tmp = (double)$var; + var_dump($tmp); +} + +echo "Done\n"; +?> +--EXPECTF-- +float(0) +float(8754456) +float(0) +float(0) +float(9876545) +float(0.1) +float(0) +float(1) +float(0) +float(1) +float(0) +float(%d) + +Notice: Object of class test could not be converted to double in %s on line %d +float(1) +Done diff --git a/Zend/tests/cast_to_int.phpt b/Zend/tests/cast_to_int.phpt new file mode 100644 index 0000000000..28c57ddf63 --- /dev/null +++ b/Zend/tests/cast_to_int.phpt @@ -0,0 +1,55 @@ +--TEST-- +casting different variables to integer +--FILE-- +<?php + +$r = fopen(__FILE__, "r"); + +class test { + function __toString() { + return "10"; + } +} + +$o = new test; + +$vars = array( + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o +); + +foreach ($vars as $var) { + $tmp = (int)$var; + var_dump($tmp); +} + +echo "Done\n"; +?> +--EXPECTF-- +int(0) +int(8754456) +int(0) +int(0) +int(9876545) +int(0) +int(0) +int(1) +int(0) +int(1) +int(0) +int(%d) + +Notice: Object of class test could not be converted to int in %s on line %d +int(1) +Done diff --git a/Zend/tests/cast_to_object.phpt b/Zend/tests/cast_to_object.phpt Binary files differnew file mode 100644 index 0000000000..586b76ae52 --- /dev/null +++ b/Zend/tests/cast_to_object.phpt diff --git a/Zend/tests/cast_to_string.phpt b/Zend/tests/cast_to_string.phpt Binary files differnew file mode 100644 index 0000000000..4d2ccb872b --- /dev/null +++ b/Zend/tests/cast_to_string.phpt diff --git a/Zend/tests/settype_array.phpt b/Zend/tests/settype_array.phpt Binary files differnew file mode 100644 index 0000000000..98c3b87978 --- /dev/null +++ b/Zend/tests/settype_array.phpt diff --git a/Zend/tests/settype_bool.phpt b/Zend/tests/settype_bool.phpt new file mode 100644 index 0000000000..cf59200b81 --- /dev/null +++ b/Zend/tests/settype_bool.phpt @@ -0,0 +1,53 @@ +--TEST-- +casting different variables to boolean using settype() +--FILE-- +<?php + +$r = fopen(__FILE__, "r"); + +class test { + function __toString() { + return "10"; + } +} + +$o = new test; + +$vars = array( + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o +); + +foreach ($vars as $var) { + settype($var, "bool"); + var_dump($var); +} + +echo "Done\n"; +?> +--EXPECTF-- +bool(true) +bool(true) +bool(false) +bool(true) +bool(true) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(true) +Done diff --git a/Zend/tests/settype_double.phpt b/Zend/tests/settype_double.phpt new file mode 100644 index 0000000000..931a3d9dff --- /dev/null +++ b/Zend/tests/settype_double.phpt @@ -0,0 +1,55 @@ +--TEST-- +casting different variables to double using settype() +--FILE-- +<?php + +$r = fopen(__FILE__, "r"); + +class test { + function __toString() { + return "10"; + } +} + +$o = new test; + +$vars = array( + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o +); + +foreach ($vars as $var) { + settype($var, "double"); + var_dump($var); +} + +echo "Done\n"; +?> +--EXPECTF-- +float(0) +float(8754456) +float(0) +float(0) +float(9876545) +float(0.1) +float(0) +float(1) +float(0) +float(1) +float(0) +float(%d) + +Notice: Object of class test could not be converted to double in %s on line %d +float(1) +Done diff --git a/Zend/tests/settype_int.phpt b/Zend/tests/settype_int.phpt new file mode 100644 index 0000000000..7b96cd594e --- /dev/null +++ b/Zend/tests/settype_int.phpt @@ -0,0 +1,55 @@ +--TEST-- +casting different variables to integer using settype() +--FILE-- +<?php + +$r = fopen(__FILE__, "r"); + +class test { + function __toString() { + return "10"; + } +} + +$o = new test; + +$vars = array( + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o +); + +foreach ($vars as $var) { + settype($var, "int"); + var_dump($var); +} + +echo "Done\n"; +?> +--EXPECTF-- +int(0) +int(8754456) +int(0) +int(0) +int(9876545) +int(0) +int(0) +int(1) +int(0) +int(1) +int(0) +int(%d) + +Notice: Object of class test could not be converted to int in %s on line %d +int(1) +Done diff --git a/Zend/tests/settype_null.phpt b/Zend/tests/settype_null.phpt new file mode 100644 index 0000000000..0abf2f9810 --- /dev/null +++ b/Zend/tests/settype_null.phpt @@ -0,0 +1,53 @@ +--TEST-- +casting different variables to null using settype() +--FILE-- +<?php + +$r = fopen(__FILE__, "r"); + +class test { + function __toString() { + return "10"; + } +} + +$o = new test; + +$vars = array( + "string", + "8754456", + "", + "\0", + 9876545, + 0.10, + array(), + array(1,2,3), + false, + true, + NULL, + $r, + $o +); + +foreach ($vars as $var) { + settype($var, "null"); + var_dump($var); +} + +echo "Done\n"; +?> +--EXPECTF-- +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +Done diff --git a/Zend/tests/settype_object.phpt b/Zend/tests/settype_object.phpt Binary files differnew file mode 100644 index 0000000000..a3a433cf98 --- /dev/null +++ b/Zend/tests/settype_object.phpt diff --git a/Zend/tests/settype_resource.phpt b/Zend/tests/settype_resource.phpt Binary files differnew file mode 100644 index 0000000000..7210613123 --- /dev/null +++ b/Zend/tests/settype_resource.phpt diff --git a/Zend/tests/settype_string.phpt b/Zend/tests/settype_string.phpt Binary files differnew file mode 100644 index 0000000000..e8e5ff1e60 --- /dev/null +++ b/Zend/tests/settype_string.phpt |