xref: /PHP-5.6/ext/reflection/tests/bug45765.phpt (revision 18d07065)
1--TEST--
2Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause an error)
3--FILE--
4<?php
5
6class foo2 {
7	const BAR = 'foobar';
8}
9
10class foo extends foo2 {
11	const BAR = "foo's bar";
12
13	function test($a = self::BAR) {
14	}
15
16	function test2($a = parent::BAR) {
17	}
18
19	function test3($a = foo::BAR) {
20	}
21
22	function test4($a = foo2::BAR) {
23	}
24}
25
26ReflectionObject::export(new foo);
27
28?>
29--EXPECTF--
30Object of class [ <user> class foo extends foo2 ] {
31  @@ %s 7-21
32
33  - Constants [1] {
34    Constant [ string BAR ] { foo's bar }
35  }
36
37  - Static properties [0] {
38  }
39
40  - Static methods [0] {
41  }
42
43  - Properties [0] {
44  }
45
46  - Dynamic properties [0] {
47  }
48
49  - Methods [4] {
50    Method [ <user> public method test ] {
51      @@ %s 10 - 11
52
53      - Parameters [1] {
54        Parameter #0 [ <optional> $a = 'foo's bar' ]
55      }
56    }
57
58    Method [ <user> public method test2 ] {
59      @@ %s 13 - 14
60
61      - Parameters [1] {
62        Parameter #0 [ <optional> $a = 'foobar' ]
63      }
64    }
65
66    Method [ <user> public method test3 ] {
67      @@ %s 16 - 17
68
69      - Parameters [1] {
70        Parameter #0 [ <optional> $a = 'foo's bar' ]
71      }
72    }
73
74    Method [ <user> public method test4 ] {
75      @@ %s 19 - 20
76
77      - Parameters [1] {
78        Parameter #0 [ <optional> $a = 'foobar' ]
79      }
80    }
81  }
82}
83