Annotation of embedaddon/php/Zend/tests/traits/interface_003.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Testing to implement Serializable interface by traits
! 3: --FILE--
! 4: <?php
! 5:
! 6: trait foo {
! 7: public function serialize() {
! 8: return 'foobar';
! 9: }
! 10: public function unserialize($x) {
! 11: var_dump($x);
! 12: }
! 13: }
! 14:
! 15: class bar implements Serializable {
! 16: use foo;
! 17: }
! 18:
! 19: var_dump($o = serialize(new bar));
! 20: var_dump(unserialize($o));
! 21:
! 22: ?>
! 23: --EXPECTF--
! 24: string(20) "C:3:"bar":6:{foobar}"
! 25: string(6) "foobar"
! 26: object(bar)#%d (0) {
! 27: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>