Annotation of embedaddon/php/ext/standard/tests/class_object/forward_static_call_001.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: forward_static_call() called from outside of a method.
3: --FILE--
4: <?php
5:
6: class A
7: {
8: const NAME = 'A';
9: public static function test() {
10: echo static::NAME, "\n";
11: }
12: }
13:
14: class B extends A
15: {
16: const NAME = 'B';
17:
18: public static function test() {
19: echo self::NAME, "\n";
20: forward_static_call(array('parent', 'test'));
21: }
22:
23: public static function test2() {
24: echo self::NAME, "\n";
25: forward_static_call(array('self', 'test'));
26: }
27:
28: public static function test3() {
29: echo self::NAME, "\n";
30: forward_static_call(array('A', 'test'));
31: }
32: }
33:
34: class C extends B
35: {
36: const NAME = 'C';
37:
38: public static function test()
39: {
40: echo self::NAME, "\n";
41: forward_static_call(array('A', 'test'));
42: }
43: }
44:
45: A::test();
46: echo "-\n";
47: B::test();
48: echo "-\n";
49: B::test2();
50: echo "-\n";
51: B::test3();
52: echo "-\n";
53: C::test();
54: echo "-\n";
55: C::test2();
56: echo "-\n";
57: C::test3();
58:
59: ?>
60: ===DONE===
61: --EXPECTF--
62: A
63: -
64: B
65: B
66: -
67: B
68: B
69: B
70: -
71: B
72: B
73: -
74: C
75: C
76: -
77: B
78: B
79: C
80: -
81: B
82: C
83: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>