From: Felipe Pena Date: Sun, 11 May 2008 22:44:10 +0000 (+0000) Subject: - New tests X-Git-Tag: RELEASE_2_0_0b1~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6a777349b25ca40e4359c027106397bcb303e8d;p=php - New tests --- diff --git a/Zend/tests/034.phpt b/Zend/tests/034.phpt new file mode 100644 index 0000000000..6e46f2645e --- /dev/null +++ b/Zend/tests/034.phpt @@ -0,0 +1,26 @@ +--TEST-- +Testing multiples 'default:' in switch +--FILE-- + +--EXPECT-- +3 diff --git a/Zend/tests/clone_001.phpt b/Zend/tests/clone_001.phpt new file mode 100644 index 0000000000..c8ff8d8340 --- /dev/null +++ b/Zend/tests/clone_001.phpt @@ -0,0 +1,10 @@ +--TEST-- +Using clone statement on non-object +--FILE-- + +--EXPECTF-- +Fatal error: __clone method called on non-object in %s on line %d diff --git a/Zend/tests/clone_002.phpt b/Zend/tests/clone_002.phpt new file mode 100644 index 0000000000..50156428e1 --- /dev/null +++ b/Zend/tests/clone_002.phpt @@ -0,0 +1,25 @@ +--TEST-- +Testing multiple clone statements +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) diff --git a/Zend/tests/clone_003.phpt b/Zend/tests/clone_003.phpt new file mode 100644 index 0000000000..362e3466e6 --- /dev/null +++ b/Zend/tests/clone_003.phpt @@ -0,0 +1,12 @@ +--TEST-- +Using clone statement on undefined variable +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: b in %s on line %d + +Fatal error: __clone method called on non-object in %s on line %d diff --git a/Zend/tests/clone_004.phpt b/Zend/tests/clone_004.phpt new file mode 100644 index 0000000000..984313ce74 --- /dev/null +++ b/Zend/tests/clone_004.phpt @@ -0,0 +1,20 @@ +--TEST-- +Testing usage of object as array on clone statement +--FILE-- +b[1]; + +?> +--EXPECTF-- +Fatal error: Cannot use object of type foo as array in %s on line %d diff --git a/Zend/tests/exception_004.phpt b/Zend/tests/exception_004.phpt new file mode 100644 index 0000000000..77d947f47e --- /dev/null +++ b/Zend/tests/exception_004.phpt @@ -0,0 +1,18 @@ +--TEST-- +Throwing exception using a class that isn't derived from the Exception base class +--FILE-- + +--EXPECTF-- +Fatal error: Exceptions must be valid objects derived from the Exception base class in %s on line %d diff --git a/Zend/tests/inter_04.phpt b/Zend/tests/inter_04.phpt new file mode 100644 index 0000000000..0703e3d9bb --- /dev/null +++ b/Zend/tests/inter_04.phpt @@ -0,0 +1,19 @@ +--TEST-- +Trying declare interface with repeated name of inherited method +--FILE-- + +--EXPECTF-- +Fatal error: Can't inherit abstract function b::b() (previously declared abstract in a) in %s on line %d diff --git a/Zend/tests/objects_024.phpt b/Zend/tests/objects_024.phpt new file mode 100644 index 0000000000..af3f879db9 --- /dev/null +++ b/Zend/tests/objects_024.phpt @@ -0,0 +1,53 @@ +--TEST-- +Testing direct assigning for property of object returned by function +--FILE-- +bar = 1; +var_dump($a, count(foo::$bar), test()->whatever); + +print "\n"; + +$a = test()->bar = NULL; +var_dump($a, count(foo::$bar), test()->whatever); + +print "\n"; + +$a = test()->bar = test(); +var_dump($a, count(foo::$bar), test()->whatever); + +print "\n"; + +?> +--EXPECTF-- +int(1) +int(1) +int(1) + +NULL +int(2) +NULL + +object(foo)#%d (0) { +} +int(3) +object(foo)#%d (0) { +} + diff --git a/Zend/tests/objects_025.phpt b/Zend/tests/objects_025.phpt new file mode 100644 index 0000000000..110ffc69b7 --- /dev/null +++ b/Zend/tests/objects_025.phpt @@ -0,0 +1,46 @@ +--TEST-- +Testing invalid method names with __call and __callstatic +--FILE-- +foooo(); +$a::foooo(); + +$b = 'aaaaa1'; +$a->$b(); +$a::$b(); + +$b = ' '; +$a->$b(); +$a::$b(); + +$b = str_repeat('a', 10000); +$a->$b(); +$a::$b(); + +$b = NULL; +$a->$b(); + +?> +--EXPECTF-- +non-static - ok +static - ok +non-static - ok +static - ok +non-static - ok +static - ok +non-static - ok +static - ok + +Fatal error: Method name must be a string in %s on line %d diff --git a/Zend/tests/objects_026.phpt b/Zend/tests/objects_026.phpt new file mode 100644 index 0000000000..eb3a89f678 --- /dev/null +++ b/Zend/tests/objects_026.phpt @@ -0,0 +1,13 @@ +--TEST-- +Using $this when out of context +--FILE-- +a = 1; +} catch (Exception $e) { +} + +?> +--EXPECTF-- +Fatal error: Using $this when not in object context in %s on line %d diff --git a/Zend/tests/objects_027.phpt b/Zend/tests/objects_027.phpt new file mode 100644 index 0000000000..b8051cbb03 --- /dev/null +++ b/Zend/tests/objects_027.phpt @@ -0,0 +1,46 @@ +--TEST-- +Testing 'new static;' calling parent method +--FILE-- +test(); +$foo::test(); + +call_user_func(array($foo, 'test')); +call_user_func(array('foo', 'test')); + +?> +--EXPECTF-- +object(foo)#%d (0) { +} + +Strict Standards: Non-static method foo::test() should not be called statically in %s on line %d + +Strict Standards: Non-static method bar::show() should not be called statically in %s on line %d +object(bar)#%d (0) { +} +object(foo)#%d (0) { +} + +Strict Standards: call_user_func() expects parameter 1 to be a valid callback, non-static method foo::test() should not be called statically in %s on line %d + +Strict Standards: Non-static method foo::test() should not be called statically in %s on line %d + +Strict Standards: Non-static method bar::show() should not be called statically in %s on line %d +object(bar)#%d (0) { +} + +