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

1.1     ! misho       1: --TEST--
        !             2: Methods using object properties
        !             3: --FILE--
        !             4: <?php
        !             5: error_reporting(E_ALL);
        !             6: 
        !             7: trait T1 {
        !             8:   public function getText() {
        !             9:     return $this->text;
        !            10:   }
        !            11: }
        !            12: 
        !            13: trait T2 {
        !            14:   public function setTextT2($val) {
        !            15:     $this->text = $val;
        !            16:   }
        !            17: }
        !            18: 
        !            19: class TraitsTest {
        !            20:   use T1;
        !            21:   use T2;
        !            22:   private $text = 'test';
        !            23:   public function setText($val) {
        !            24:     $this->text = $val;
        !            25:   }
        !            26: }
        !            27: 
        !            28: $o = new TraitsTest();
        !            29: var_dump($o->getText());
        !            30: 
        !            31: $o->setText('foo');
        !            32: 
        !            33: var_dump($o->getText());
        !            34: 
        !            35: $o->setText('bar');
        !            36: 
        !            37: var_dump($o->getText());
        !            38: ?>
        !            39: --EXPECTF--    
        !            40: string(4) "test"
        !            41: string(3) "foo"
        !            42: string(3) "bar"

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