Annotation of embedaddon/php/tests/classes/inheritance_002.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: ZE2 Constructor precedence
! 3: --SKIPIF--
! 4: <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
! 5: --FILE--
! 6: <?php
! 7: class Base_php4 {
! 8: function Base_php4() {
! 9: var_dump('Base constructor');
! 10: }
! 11: }
! 12:
! 13: class Child_php4 extends Base_php4 {
! 14: function Child_php4() {
! 15: var_dump('Child constructor');
! 16: parent::Base_php4();
! 17: }
! 18: }
! 19:
! 20: class Base_php5 {
! 21: function __construct() {
! 22: var_dump('Base constructor');
! 23: }
! 24: }
! 25:
! 26: class Child_php5 extends Base_php5 {
! 27: function __construct() {
! 28: var_dump('Child constructor');
! 29: parent::__construct();
! 30: }
! 31: }
! 32:
! 33: class Child_mx1 extends Base_php4 {
! 34: function __construct() {
! 35: var_dump('Child constructor');
! 36: parent::Base_php4();
! 37: }
! 38: }
! 39:
! 40: class Child_mx2 extends Base_php5 {
! 41: function Child_mx2() {
! 42: var_dump('Child constructor');
! 43: parent::__construct();
! 44: }
! 45: }
! 46:
! 47: echo "### PHP 4 style\n";
! 48: $c4= new Child_php4();
! 49:
! 50: echo "### PHP 5 style\n";
! 51: $c5= new Child_php5();
! 52:
! 53: echo "### Mixed style 1\n";
! 54: $cm= new Child_mx1();
! 55:
! 56: echo "### Mixed style 2\n";
! 57: $cm= new Child_mx2();
! 58: ?>
! 59: --EXPECT--
! 60: ### PHP 4 style
! 61: string(17) "Child constructor"
! 62: string(16) "Base constructor"
! 63: ### PHP 5 style
! 64: string(17) "Child constructor"
! 65: string(16) "Base constructor"
! 66: ### Mixed style 1
! 67: string(17) "Child constructor"
! 68: string(16) "Base constructor"
! 69: ### Mixed style 2
! 70: string(17) "Child constructor"
! 71: string(16) "Base constructor"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>