From 5790b80c53fc7e8a571906872cd127de46cfaecd Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Mon, 12 May 2008 17:55:21 +0000 Subject: [PATCH] - New tests --- Zend/tests/035.phpt | 18 +++++++++++ Zend/tests/class_alias_021.phpt | 25 ++++++++++++++++ Zend/tests/class_exists_001.phpt | 27 +++++++++++++++++ Zend/tests/class_exists_002.phpt | 26 ++++++++++++++++ Zend/tests/class_exists_003.phpt | 20 +++++++++++++ Zend/tests/constants_001.phpt | 25 ++++++++++++++++ Zend/tests/constants_002.phpt | 24 +++++++++++++++ Zend/tests/constants_003.phpt | 21 +++++++++++++ Zend/tests/constants_004.phpt | 13 ++++++++ Zend/tests/each_001.phpt | 10 +++++++ Zend/tests/each_002.phpt | 45 ++++++++++++++++++++++++++++ Zend/tests/each_003.phpt | 37 +++++++++++++++++++++++ Zend/tests/exception_005.phpt | 12 ++++++++ Zend/tests/exception_006.phpt | 10 +++++++ Zend/tests/get_called_class_001.phpt | 11 +++++++ Zend/tests/get_parent_class_001.phpt | 31 +++++++++++++++++++ Zend/tests/heredoc_018.phpt | 17 +++++++++++ Zend/tests/inter_05.phpt | 10 +++++++ Zend/tests/inter_06.phpt | 10 +++++++ Zend/tests/interface_exists_001.phpt | 21 +++++++++++++ Zend/tests/interface_exists_002.phpt | 23 ++++++++++++++ Zend/tests/list_006.phpt | 14 +++++++++ Zend/tests/objects_028.phpt | 25 ++++++++++++++++ Zend/tests/objects_029.phpt | 26 ++++++++++++++++ Zend/tests/objects_030.phpt | 26 ++++++++++++++++ 25 files changed, 527 insertions(+) create mode 100644 Zend/tests/035.phpt create mode 100644 Zend/tests/class_alias_021.phpt create mode 100644 Zend/tests/class_exists_001.phpt create mode 100644 Zend/tests/class_exists_002.phpt create mode 100644 Zend/tests/class_exists_003.phpt create mode 100644 Zend/tests/constants_001.phpt create mode 100644 Zend/tests/constants_002.phpt create mode 100644 Zend/tests/constants_003.phpt create mode 100644 Zend/tests/constants_004.phpt create mode 100644 Zend/tests/each_001.phpt create mode 100644 Zend/tests/each_002.phpt create mode 100644 Zend/tests/each_003.phpt create mode 100644 Zend/tests/exception_005.phpt create mode 100644 Zend/tests/exception_006.phpt create mode 100644 Zend/tests/get_called_class_001.phpt create mode 100644 Zend/tests/get_parent_class_001.phpt create mode 100644 Zend/tests/heredoc_018.phpt create mode 100644 Zend/tests/inter_05.phpt create mode 100644 Zend/tests/inter_06.phpt create mode 100644 Zend/tests/interface_exists_001.phpt create mode 100644 Zend/tests/interface_exists_002.phpt create mode 100644 Zend/tests/list_006.phpt create mode 100644 Zend/tests/objects_028.phpt create mode 100644 Zend/tests/objects_029.phpt create mode 100644 Zend/tests/objects_030.phpt diff --git a/Zend/tests/035.phpt b/Zend/tests/035.phpt new file mode 100644 index 0000000000000..75df786e88fe1 --- /dev/null +++ b/Zend/tests/035.phpt @@ -0,0 +1,18 @@ +--TEST-- +Using 'static' and 'global' in global scope +--FILE-- + +--EXPECT-- +int(-1) +int(-1) +int(-1) diff --git a/Zend/tests/class_alias_021.phpt b/Zend/tests/class_alias_021.phpt new file mode 100644 index 0000000000000..79049623f0c6a --- /dev/null +++ b/Zend/tests/class_alias_021.phpt @@ -0,0 +1,25 @@ +--TEST-- +Overriding internal class with class alias +--FILE-- + +--EXPECTF-- +object(foo::bar)#%d (0) { +} +object(foo::bar)#%d (0) { +} +object(foo::bar)#%d (0) { +} diff --git a/Zend/tests/class_exists_001.phpt b/Zend/tests/class_exists_001.phpt new file mode 100644 index 0000000000000..4ee1ee2925ea5 --- /dev/null +++ b/Zend/tests/class_exists_001.phpt @@ -0,0 +1,27 @@ +--TEST-- +Testing class_exists() inside namespace +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(false) +bool(true) +bool(false) diff --git a/Zend/tests/class_exists_002.phpt b/Zend/tests/class_exists_002.phpt new file mode 100644 index 0000000000000..da9c0d2737ae4 --- /dev/null +++ b/Zend/tests/class_exists_002.phpt @@ -0,0 +1,26 @@ +--TEST-- +Testing several valid and invalid parameters +--FILE-- + +--EXPECTF-- +bool(false) +bool(false) +bool(true) +bool(false) +bool(false) + +Warning: class_exists() expects parameter 1 to be string (Unicode or binary), object given in %s on line %d +NULL diff --git a/Zend/tests/class_exists_003.phpt b/Zend/tests/class_exists_003.phpt new file mode 100644 index 0000000000000..ad7bafa3a7570 --- /dev/null +++ b/Zend/tests/class_exists_003.phpt @@ -0,0 +1,20 @@ +--TEST-- +Checking if exists interface, abstract and final class +--FILE-- + +--EXPECT-- +bool(false) +bool(true) +bool(true) diff --git a/Zend/tests/constants_001.phpt b/Zend/tests/constants_001.phpt new file mode 100644 index 0000000000000..8419eb6613de0 --- /dev/null +++ b/Zend/tests/constants_001.phpt @@ -0,0 +1,25 @@ +--TEST-- +Defining and using constants +--FILE-- + +--EXPECTF-- +Notice: Constant 1 already defined in %s on line %d +int(2) +int(2) +int(2) +int(1) +int(3) diff --git a/Zend/tests/constants_002.phpt b/Zend/tests/constants_002.phpt new file mode 100644 index 0000000000000..2e769f5dbf879 --- /dev/null +++ b/Zend/tests/constants_002.phpt @@ -0,0 +1,24 @@ +--TEST-- +Defining constants with non-scalar values +--FILE-- + +--EXPECTF-- +Warning: Constants may only evaluate to scalar values in %s on line %d + +Notice: Use of undefined constant foo - assumed 'foo' in %s on line %d +string(%d) "foo" +resource(%d) of type (stream) +--UEXPECTF-- +Warning: Constants may only evaluate to scalar values in %s on line %d + +Notice: Use of undefined constant foo - assumed 'foo' in %s on line %d +unicode(%d) "foo" +resource(%d) of type (stream) diff --git a/Zend/tests/constants_003.phpt b/Zend/tests/constants_003.phpt new file mode 100644 index 0000000000000..ec3eb6d4ff7f0 --- /dev/null +++ b/Zend/tests/constants_003.phpt @@ -0,0 +1,21 @@ +--TEST-- +Using namespace constants and constants of global scope +--FILE-- + +--EXPECT-- +int(1) +int(1) +int(1) +int(2) +int(2) +int(1) diff --git a/Zend/tests/constants_004.phpt b/Zend/tests/constants_004.phpt new file mode 100644 index 0000000000000..787ec26e724ba --- /dev/null +++ b/Zend/tests/constants_004.phpt @@ -0,0 +1,13 @@ +--TEST-- +Trying to redeclare constant inside namespace +--FILE-- + +--EXPECTF-- +Notice: Constant foo::foo already defined in %s on line %d diff --git a/Zend/tests/each_001.phpt b/Zend/tests/each_001.phpt new file mode 100644 index 0000000000000..06ab52a9c8633 --- /dev/null +++ b/Zend/tests/each_001.phpt @@ -0,0 +1,10 @@ +--TEST-- +Testing each() with an undefined variable +--FILE-- + +--EXPECTF-- +Warning: Variable passed to each() is not an array or object in %s on line %d diff --git a/Zend/tests/each_002.phpt b/Zend/tests/each_002.phpt new file mode 100644 index 0000000000000..59ff7a75dd59c --- /dev/null +++ b/Zend/tests/each_002.phpt @@ -0,0 +1,45 @@ +--TEST-- +Testing each() with array and object +--FILE-- + +--EXPECTF-- +bool(false) +bool(false) +array(4) { + [1]=> + object(stdClass)#1 (0) { + } + ["value"]=> + object(stdClass)#1 (0) { + } + [0]=> + int(0) + ["key"]=> + int(0) +} +--UEXPECTF-- +bool(false) +bool(false) +array(4) { + [1]=> + object(stdClass)#1 (0) { + } + [u"value"]=> + object(stdClass)#1 (0) { + } + [0]=> + int(0) + [u"key"]=> + int(0) +} diff --git a/Zend/tests/each_003.phpt b/Zend/tests/each_003.phpt new file mode 100644 index 0000000000000..8c0c32a7f7afb --- /dev/null +++ b/Zend/tests/each_003.phpt @@ -0,0 +1,37 @@ +--TEST-- +Testing each() with recursion +--FILE-- + +--EXPECTF-- +array(4) { + [1]=> + array(0) { + } + ["value"]=> + array(0) { + } + [0]=> + int(0) + ["key"]=> + int(0) +} +--UEXPECTF-- +array(4) { + [1]=> + array(0) { + } + [u"value"]=> + array(0) { + } + [0]=> + int(0) + [u"key"]=> + int(0) +} diff --git a/Zend/tests/exception_005.phpt b/Zend/tests/exception_005.phpt new file mode 100644 index 0000000000000..45a926960511f --- /dev/null +++ b/Zend/tests/exception_005.phpt @@ -0,0 +1,12 @@ +--TEST-- +Trying to throw exception of an interface +--FILE-- + +--EXPECTF-- +Fatal error: Cannot instantiate interface a in %s on line %d diff --git a/Zend/tests/exception_006.phpt b/Zend/tests/exception_006.phpt new file mode 100644 index 0000000000000..5c981fc1b67be --- /dev/null +++ b/Zend/tests/exception_006.phpt @@ -0,0 +1,10 @@ +--TEST-- +Trying to throw a non-object +--FILE-- + +--EXPECTF-- +Fatal error: Can only throw objects in %s on line %d diff --git a/Zend/tests/get_called_class_001.phpt b/Zend/tests/get_called_class_001.phpt new file mode 100644 index 0000000000000..7012ae8129fe5 --- /dev/null +++ b/Zend/tests/get_called_class_001.phpt @@ -0,0 +1,11 @@ +--TEST-- +Calling get_called_class() outside a class +--FILE-- + +--EXPECTF-- +Warning: get_called_class() called from outside a class in %s on line %d +bool(false) diff --git a/Zend/tests/get_parent_class_001.phpt b/Zend/tests/get_parent_class_001.phpt new file mode 100644 index 0000000000000..5115fe16d8a54 --- /dev/null +++ b/Zend/tests/get_parent_class_001.phpt @@ -0,0 +1,31 @@ +--TEST-- +Testing get_parent_class() +--FILE-- +foo(); + +?> +--EXPECT-- +string(3) "bar" +bool(false) +--UEXPECT-- +unicode(3) "bar" +bool(false) diff --git a/Zend/tests/heredoc_018.phpt b/Zend/tests/heredoc_018.phpt new file mode 100644 index 0000000000000..c10e9c1c4e296 --- /dev/null +++ b/Zend/tests/heredoc_018.phpt @@ -0,0 +1,17 @@ +--TEST-- +Testing heredoc with tabs before identifier +--FILE-- + +--EXPECT-- +bool(true) diff --git a/Zend/tests/inter_05.phpt b/Zend/tests/inter_05.phpt new file mode 100644 index 0000000000000..7d5d13ea37dda --- /dev/null +++ b/Zend/tests/inter_05.phpt @@ -0,0 +1,10 @@ +--TEST-- +Trying to inherit a class in an interface +--FILE-- + +--EXPECTF-- +Fatal error: a cannot implement Exception - it is not an interface in %s on line %d diff --git a/Zend/tests/inter_06.phpt b/Zend/tests/inter_06.phpt new file mode 100644 index 0000000000000..1987c24a8b96a --- /dev/null +++ b/Zend/tests/inter_06.phpt @@ -0,0 +1,10 @@ +--TEST-- +Trying use name of an internal class as interface name +--FILE-- + +--EXPECTF-- +Fatal error: Cannot redeclare class stdClass in %s on line %d diff --git a/Zend/tests/interface_exists_001.phpt b/Zend/tests/interface_exists_001.phpt new file mode 100644 index 0000000000000..2893e75dde6a2 --- /dev/null +++ b/Zend/tests/interface_exists_001.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing interface_exists() +--FILE-- + +--EXPECTF-- +bool(true) +bool(false) +bool(false) + +Warning: interface_exists() expects parameter 1 to be string (Unicode or binary), object given in %s on line %d +NULL diff --git a/Zend/tests/interface_exists_002.phpt b/Zend/tests/interface_exists_002.phpt new file mode 100644 index 0000000000000..f4d8a03cd828d --- /dev/null +++ b/Zend/tests/interface_exists_002.phpt @@ -0,0 +1,23 @@ +--TEST-- +Testing interface_exists() inside a namespace +--FILE-- + +--EXPECT-- +bool(false) +bool(true) +bool(true) diff --git a/Zend/tests/list_006.phpt b/Zend/tests/list_006.phpt new file mode 100644 index 0000000000000..f5f5970be4983 --- /dev/null +++ b/Zend/tests/list_006.phpt @@ -0,0 +1,14 @@ +--TEST-- +Testing nested list() with empty array +--FILE-- + +--EXPECTF-- +Notice: Undefined offset: 1 in %s on line %d + +Notice: Undefined offset: 1 in %s on line %d + +Notice: Undefined offset: 0 in %s on line %d diff --git a/Zend/tests/objects_028.phpt b/Zend/tests/objects_028.phpt new file mode 100644 index 0000000000000..5c76612938fe2 --- /dev/null +++ b/Zend/tests/objects_028.phpt @@ -0,0 +1,25 @@ +--TEST-- +Testing 'static::' and 'parent::' in calls +--FILE-- + +--EXPECT-- +hello +hello diff --git a/Zend/tests/objects_029.phpt b/Zend/tests/objects_029.phpt new file mode 100644 index 0000000000000..5e8de185f2541 --- /dev/null +++ b/Zend/tests/objects_029.phpt @@ -0,0 +1,26 @@ +--TEST-- +Trying to access undeclared static property +--FILE-- + +--EXPECTF-- +Fatal error: Access to undeclared static property: foo::$f in %s on line %d diff --git a/Zend/tests/objects_030.phpt b/Zend/tests/objects_030.phpt new file mode 100644 index 0000000000000..8b7cfe39a8b2e --- /dev/null +++ b/Zend/tests/objects_030.phpt @@ -0,0 +1,26 @@ +--TEST-- +Trying to access undeclared parent property +--FILE-- + +--EXPECTF-- +Fatal error: Access to undeclared static property: bar::$f in %s on line %d