diff options
-rw-r--r-- | tests/classes/final_ctor3.phpt | 6 | ||||
-rw-r--r-- | tests/classes/inheritance_005.phpt | 45 |
2 files changed, 32 insertions, 19 deletions
diff --git a/tests/classes/final_ctor3.phpt b/tests/classes/final_ctor3.phpt index d37e864e2d..3a61ecf902 100644 --- a/tests/classes/final_ctor3.phpt +++ b/tests/classes/final_ctor3.phpt @@ -6,10 +6,8 @@ Ensure implicit final inherited old-style constructor cannot be overridden. final function A() { } } class B extends A { - } - class C extends B { - function B() { } + function A() { } } ?> --EXPECTF-- -Fatal error: Cannot override final method A::B() in %s on line 9 +Fatal error: Cannot override final method A::A() in %s on line %d diff --git a/tests/classes/inheritance_005.phpt b/tests/classes/inheritance_005.phpt index b6f47b2a66..8990264d92 100644 --- a/tests/classes/inheritance_005.phpt +++ b/tests/classes/inheritance_005.phpt @@ -19,24 +19,39 @@ Check for inherited old-style constructor. } - echo "About to construct new B: "; + echo "About to construct new B: \n"; $b = new B; - echo "About to invoke implicit B::B(): "; - $b->B(); - echo "\nAbout to construct new C: "; + 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 "About to invoke implicit C::B(): "; - $c->B(); - echo "About to invoke implicit C::C(): "; - $c->C(); -?> ---EXPECTF-- -About to construct new B: In A::A -About to invoke implicit B::B(): In A::A -About to construct new C: In A::A -About to invoke implicit C::B(): In A::A -About to invoke implicit C::C(): In A::A + 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-- +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) |