Annotation of embedaddon/php/Zend/tests/traits/bug55554c.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #55137 (Legacy constructor not registered for class)
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: // Test that the behavior is consistent with the existing handling of new
        !             7: // and legacy constructors.
        !             8: // Here, the traits conflicts are overridden by local definitions,
        !             9: // and the two constructor definitions do not directly collide in that case.
        !            10: 
        !            11: trait TC1 {
        !            12:     public function __construct() {
        !            13:         echo "TC1 executed\n";
        !            14:     }
        !            15:     public function ReportCollision() {
        !            16:         echo "TC1 executed\n";
        !            17:     }
        !            18: }
        !            19: 
        !            20: trait TC2 {
        !            21:     public function __construct() {
        !            22:         echo "TC2 executed\n";
        !            23:     }
        !            24:     public function ReportCollision() {
        !            25:         echo "TC1 executed\n";
        !            26:     }
        !            27: }
        !            28: 
        !            29: class ReportCollision {
        !            30:        use TC1, TC2;
        !            31:        
        !            32:        public function __construct() {
        !            33:         echo "New constructor executed\n";
        !            34:     }
        !            35:     public function ReportCollision() {
        !            36:         echo "Legacy constructor executed\n";
        !            37:     }
        !            38: }
        !            39: 
        !            40: 
        !            41: echo "ReportCollision: ";
        !            42: $o = new ReportCollision;
        !            43: 
        !            44: 
        !            45: --EXPECTF--
        !            46: ReportCollision: New constructor executed

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>