diff options
Diffstat (limited to 'tests/classes')
| -rw-r--r-- | tests/classes/__set_data_corrupt.phpt | 2 | ||||
| -rwxr-xr-x | tests/classes/array_access_013.phpt | 2 | ||||
| -rw-r--r-- | tests/classes/bug27504.phpt | 3 | ||||
| -rwxr-xr-x | tests/classes/destructor_and_echo.phpt | 2 | ||||
| -rwxr-xr-x | tests/classes/destructor_and_references.phpt | 4 | ||||
| -rwxr-xr-x | tests/classes/final_ctor1.phpt | 29 | ||||
| -rwxr-xr-x | tests/classes/final_ctor2.phpt | 29 | ||||
| -rwxr-xr-x | tests/classes/property_exists.phpt | 222 | ||||
| -rwxr-xr-x | tests/classes/static_properties_002.phpt | 62 | ||||
| -rwxr-xr-x | tests/classes/static_this.phpt | 2 |
10 files changed, 66 insertions, 291 deletions
diff --git a/tests/classes/__set_data_corrupt.phpt b/tests/classes/__set_data_corrupt.phpt index 86c39243d..6a52bd489 100644 --- a/tests/classes/__set_data_corrupt.phpt +++ b/tests/classes/__set_data_corrupt.phpt @@ -1,5 +1,5 @@ --TEST-- -Data corruption in __set +ZE2 Data corruption in __set --SKIPIF-- <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?> --FILE-- diff --git a/tests/classes/array_access_013.phpt b/tests/classes/array_access_013.phpt index c3dee3f5c..206d9d540 100755 --- a/tests/classes/array_access_013.phpt +++ b/tests/classes/array_access_013.phpt @@ -1,5 +1,5 @@ --TEST-- -ZE2 arrayAcces & exceptions +ZE2 ArrayAccess and exceptions --FILE-- <?php diff --git a/tests/classes/bug27504.phpt b/tests/classes/bug27504.phpt index 64d68ba8a..ca13990c9 100644 --- a/tests/classes/bug27504.phpt +++ b/tests/classes/bug27504.phpt @@ -20,5 +20,6 @@ Bug #27504 (call_user_func_array allows calling of private/protected methods) --EXPECTF-- Called function foo:bar(%d) -Fatal error: Call to private method foo::bar() from context '' in %s on line 13 +Warning: call_user_func_array(): First argument is expected to be a valid callback, 'foo::bar' was given in %sbug27504.php on line %d +Fatal error: Call to private method foo::bar() from context '' in %s on line %d diff --git a/tests/classes/destructor_and_echo.phpt b/tests/classes/destructor_and_echo.phpt index c6c6f23a7..0a253593a 100755 --- a/tests/classes/destructor_and_echo.phpt +++ b/tests/classes/destructor_and_echo.phpt @@ -1,5 +1,5 @@ --TEST-- -Destructors and echo +ZE2 Destructors and echo --FILE-- <?php diff --git a/tests/classes/destructor_and_references.phpt b/tests/classes/destructor_and_references.phpt index 66e8b41f7..6b9b019b6 100755 --- a/tests/classes/destructor_and_references.phpt +++ b/tests/classes/destructor_and_references.phpt @@ -1,5 +1,5 @@ --TEST-- -Destructing and references +ZE2 Destructing and references --FILE-- <?php @@ -23,4 +23,4 @@ $o = new once; echo "Done\n"; ?> --EXPECT-- -Done
\ No newline at end of file +Done diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt new file mode 100755 index 000000000..ebfa08081 --- /dev/null +++ b/tests/classes/final_ctor1.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 cannot override final __construct +--FILE-- +<?php + +class Base +{ + public final function __construct() + { + } +} + +class Works extends Base +{ +} + +class Extended extends Base +{ + public function Extended() + { + } +} + +ReflectionClass::export('Extended'); + +?> +--EXPECTF-- + +Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d diff --git a/tests/classes/final_ctor2.phpt b/tests/classes/final_ctor2.phpt new file mode 100755 index 000000000..905337b40 --- /dev/null +++ b/tests/classes/final_ctor2.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 cannot override final old style ctor +--FILE-- +<?php + +class Base +{ + public final function Base() + { + } +} + +class Works extends Base +{ +} + +class Extended extends Base +{ + public function __construct() + { + } +} + +ReflectionClass::export('Extended'); + +?> +--EXPECTF-- + +Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d diff --git a/tests/classes/property_exists.phpt b/tests/classes/property_exists.phpt deleted file mode 100755 index fa712dfdb..000000000 --- a/tests/classes/property_exists.phpt +++ /dev/null @@ -1,222 +0,0 @@ ---TEST-- -ZE2 property_exists() ---FILE-- -<?php - -class A -{ - public $a = 1; - protected $b = 2; - private $c = 3; - - public $empty; - public $init = 1; - - function __toString() - { - return 'obj(' . get_class($this) . ')'; - } - - static function test($oc, $props) - { - echo '===' . __CLASS__ . "===\n"; - foreach($props as $p2) { - echo $oc, '::$' , $p2, "\n"; - var_dump(property_exists($oc, $p2)); - } - } -} - -class B extends A -{ - private $c = 4; - - static function test($oc, $props) - { - echo '===' . __CLASS__ . "===\n"; - foreach($props as $p2) { - echo $oc, '::$' , $p2, "\n"; - var_dump(property_exists($oc, $p2)); - } - } -} - -class C extends B -{ - private $d = 5; - - static function test($oc, $props) - { - echo '===' . __CLASS__ . "===\n"; - foreach($props as $p2) { - echo $oc, '::$' , $p2, "\n"; - var_dump(property_exists($oc, $p2)); - } - } -} - -$oA = new A; -$oA->e = 6; - -$oC = new C; - -$pc = array($oA, 'A', 'B', 'C', $oC); -$pr = array('a', 'b', 'c', 'd', 'e'); - -foreach($pc as $p1) { - if (is_object($p1)) { - $p1->test($p1, $pr); - } else { - $r = new ReflectionMethod($p1, 'test'); - $r->invoke(NULL, $p1, $pr); - } - echo "===GLOBAL===\n"; - foreach($pr as $p2) { - echo $p1, '::$' , $p2, "\n"; - var_dump(property_exists($p1, $p2)); - } -} - -echo "===PROBLEMS===\n"; -var_dump(property_exists(NULL, 'empty')); -var_dump(property_exists(25,'empty')); -var_dump(property_exists('','')); -var_dump(property_exists('A','')); -var_dump(property_exists('A','123')); -var_dump(property_exists('A','init')); -var_dump(property_exists('A','empty')); -var_dump(property_exists(new A, '')); -var_dump(property_exists(new A, '123')); -var_dump(property_exists(new A, 'init')); -var_dump(property_exists(new A, 'empty')); -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -===A=== -obj(A)::$a -bool(true) -obj(A)::$b -bool(true) -obj(A)::$c -bool(true) -obj(A)::$d -bool(false) -obj(A)::$e -bool(true) -===GLOBAL=== -obj(A)::$a -bool(true) -obj(A)::$b -bool(false) -obj(A)::$c -bool(false) -obj(A)::$d -bool(false) -obj(A)::$e -bool(true) -===A=== -A::$a -bool(true) -A::$b -bool(true) -A::$c -bool(true) -A::$d -bool(false) -A::$e -bool(false) -===GLOBAL=== -A::$a -bool(true) -A::$b -bool(false) -A::$c -bool(false) -A::$d -bool(false) -A::$e -bool(false) -===B=== -B::$a -bool(true) -B::$b -bool(true) -B::$c -bool(true) -B::$d -bool(false) -B::$e -bool(false) -===GLOBAL=== -B::$a -bool(true) -B::$b -bool(false) -B::$c -bool(false) -B::$d -bool(false) -B::$e -bool(false) -===C=== -C::$a -bool(true) -C::$b -bool(true) -C::$c -bool(false) -C::$d -bool(true) -C::$e -bool(false) -===GLOBAL=== -C::$a -bool(true) -C::$b -bool(false) -C::$c -bool(false) -C::$d -bool(false) -C::$e -bool(false) -===C=== -obj(C)::$a -bool(true) -obj(C)::$b -bool(true) -obj(C)::$c -bool(false) -obj(C)::$d -bool(true) -obj(C)::$e -bool(false) -===GLOBAL=== -obj(C)::$a -bool(true) -obj(C)::$b -bool(false) -obj(C)::$c -bool(false) -obj(C)::$d -bool(false) -obj(C)::$e -bool(false) -===PROBLEMS=== - -Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists.php on line %d -NULL - -Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists.php on line %d -NULL -bool(false) -bool(false) -bool(false) -bool(true) -bool(true) -bool(false) -bool(false) -bool(true) -bool(true) -===DONE=== diff --git a/tests/classes/static_properties_002.phpt b/tests/classes/static_properties_002.phpt deleted file mode 100755 index 29b84a8e6..000000000 --- a/tests/classes/static_properties_002.phpt +++ /dev/null @@ -1,62 +0,0 @@ ---TEST-- -ZE2 Inheriting static properties ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class base { - static protected $prop = 2; - - static function show() { - echo __METHOD__ . '(' . self::$prop . ")\n"; - } - - static function inc() { - base::$prop++; - echo __METHOD__ . "()\n"; - } -} - -class derived extends base { - static public $prop; - - static function show() { - echo __METHOD__ . '(' . self::$prop . ")\n"; - } - - static function inc() { - derived::$prop++; - echo __METHOD__ . "()\n"; - } -} - -base::show(); -derived::show(); - -base::inc(); - -base::show(); -derived::show(); - -derived::inc(); - -base::show(); -derived::show(); - -$r = new ReflectionClass('derived'); -echo 'Number of properties: '. count($r->getStaticProperties()) . "\n"; - -echo "Done\n"; -?> ---EXPECTF-- -base::show(2) -derived::show(2) -base::inc() -base::show(3) -derived::show(3) -derived::inc() -base::show(4) -derived::show(4) -Number of properties: 1 -Done diff --git a/tests/classes/static_this.phpt b/tests/classes/static_this.phpt index 12f4b6389..91b028719 100755 --- a/tests/classes/static_this.phpt +++ b/tests/classes/static_this.phpt @@ -1,5 +1,5 @@ --TEST-- -$this can be an argument to a static function +ZE2 $this can be an argument to a static function --FILE-- <?php |
