diff options
Diffstat (limited to 'tests/classes')
| -rw-r--r-- | tests/classes/ctor_name_clash.phpt | 23 | ||||
| -rw-r--r-- | tests/classes/final_ctor1.phpt | 8 | ||||
| -rw-r--r-- | tests/classes/final_ctor2.phpt | 30 | ||||
| -rw-r--r-- | tests/classes/final_ctor3.phpt | 15 | ||||
| -rw-r--r-- | tests/classes/inheritance_002.phpt | 74 | ||||
| -rw-r--r-- | tests/classes/inheritance_005.phpt | 58 | ||||
| -rw-r--r-- | tests/classes/inheritance_007.phpt | 40 |
7 files changed, 2 insertions, 246 deletions
diff --git a/tests/classes/ctor_name_clash.phpt b/tests/classes/ctor_name_clash.phpt deleted file mode 100644 index e6518775ff..0000000000 --- a/tests/classes/ctor_name_clash.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -ZE2 The child class can re-use the parent class name for a function member ---FILE-- -<?php -class base { - function base() { - echo __CLASS__."::".__FUNCTION__."\n"; - } -} - -class derived extends base { - function base() { - echo __CLASS__."::".__FUNCTION__."\n"; - } -} - -$obj = new derived(); -$obj->base(); -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; base has a deprecated constructor in %s on line %d -base::base -derived::base diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt index acf20918fd..33fcbe6bd8 100644 --- a/tests/classes/final_ctor1.phpt +++ b/tests/classes/final_ctor1.phpt @@ -16,15 +16,11 @@ class Works extends Base class Extended extends Base { - public function Extended() + public function __construct() { } } -ReflectionClass::export('Extended'); - ?> --EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Extended has a deprecated constructor in %s on line %d - -Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d +Fatal error: Cannot override final method Base::__construct() in %s on line %d diff --git a/tests/classes/final_ctor2.phpt b/tests/classes/final_ctor2.phpt deleted file mode 100644 index 37fcac29a9..0000000000 --- a/tests/classes/final_ctor2.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---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-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base has a deprecated constructor in %s on line %d - -Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d diff --git a/tests/classes/final_ctor3.phpt b/tests/classes/final_ctor3.phpt deleted file mode 100644 index b34996c979..0000000000 --- a/tests/classes/final_ctor3.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Ensure implicit final inherited old-style constructor cannot be overridden. ---FILE-- -<?php - class A { - final function A() { } - } - class B extends A { - function A() { } - } -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d - -Fatal error: Cannot override final method A::A() in %s on line %d diff --git a/tests/classes/inheritance_002.phpt b/tests/classes/inheritance_002.phpt deleted file mode 100644 index f88c0996bd..0000000000 --- a/tests/classes/inheritance_002.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -ZE2 Constructor precedence ---FILE-- -<?php -class Base_php4 { - function Base_php4() { - var_dump('Base constructor'); - } -} - -class Child_php4 extends Base_php4 { - function Child_php4() { - var_dump('Child constructor'); - parent::Base_php4(); - } -} - -class Base_php5 { - function __construct() { - var_dump('Base constructor'); - } - } - -class Child_php5 extends Base_php5 { - function __construct() { - var_dump('Child constructor'); - parent::__construct(); - } - } - -class Child_mx1 extends Base_php4 { - function __construct() { - var_dump('Child constructor'); - parent::Base_php4(); - } -} - -class Child_mx2 extends Base_php5 { - function Child_mx2() { - var_dump('Child constructor'); - parent::__construct(); - } -} - -echo "### PHP 4 style\n"; -$c4= new Child_php4(); - -echo "### PHP 5 style\n"; -$c5= new Child_php5(); - -echo "### Mixed style 1\n"; -$cm= new Child_mx1(); - -echo "### Mixed style 2\n"; -$cm= new Child_mx2(); -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base_php4 has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_php4 has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_mx2 has a deprecated constructor in %s on line %d -### PHP 4 style -string(17) "Child constructor" -string(16) "Base constructor" -### PHP 5 style -string(17) "Child constructor" -string(16) "Base constructor" -### Mixed style 1 -string(17) "Child constructor" -string(16) "Base constructor" -### Mixed style 2 -string(17) "Child constructor" -string(16) "Base constructor" diff --git a/tests/classes/inheritance_005.phpt b/tests/classes/inheritance_005.phpt deleted file mode 100644 index 8c5167f4bf..0000000000 --- a/tests/classes/inheritance_005.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -Check for inherited old-style constructor. ---FILE-- -<?php - class A - { - function A() - { - echo "In " . __METHOD__ . "\n"; - } - } - - class B extends A - { - } - - class C extends B - { - } - - - echo "About to construct new B: \n"; - $b = new B; - - echo "Is B::B() callable?\n"; - var_dump(is_callable(array($b, "B"))); - - echo "Is B::A() callable?\n"; - var_dump(is_callable(array($b, "A"))); - - echo "About to construct new C: \n"; - $c = new C; - - echo "Is C::A() callable?\n"; - var_dump(is_callable(array($c, "A"))); - - echo "Is C::B() callable?\n"; - var_dump(is_callable(array($c, "B"))); - - echo "Is C::C() callable?\n"; - var_dump(is_callable(array($c, "C"))); -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d -About to construct new B: -In A::A -Is B::B() callable? -bool(false) -Is B::A() callable? -bool(true) -About to construct new C: -In A::A -Is C::A() callable? -bool(true) -Is C::B() callable? -bool(false) -Is C::C() callable? -bool(false) diff --git a/tests/classes/inheritance_007.phpt b/tests/classes/inheritance_007.phpt deleted file mode 100644 index c87fbde344..0000000000 --- a/tests/classes/inheritance_007.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Ensure inherited old-style constructor doesn't block other methods ---FILE-- -<?php -class A { - public function B () { echo "In " . __METHOD__ . "\n"; } - public function A () { echo "In " . __METHOD__ . "\n"; } -} -class B extends A { } - -$rc = new ReflectionClass('B'); -var_dump($rc->getMethods()); - - -$b = new B(); -$b->a(); -$b->b(); - -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d -array(2) { - [0]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(1) "B" - ["class"]=> - string(1) "A" - } - [1]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(1) "A" - ["class"]=> - string(1) "A" - } -} -In A::A -In A::A -In A::B |
