29
29
30
30
use __PHP_Incomplete_Class ;
31
31
use Kint \Test \Fixtures \ChildTestClass ;
32
+ use Kint \Test \Fixtures \OtherChildTestClass ;
32
33
use Kint \Test \Fixtures \TestClass ;
33
34
use Kint \Test \KintTestCase ;
34
35
use Kint \Value \Context \ClassDeclaredContext ;
@@ -45,6 +46,10 @@ public function isAccessibleProvider()
45
46
$ pro = new PropertyContext ('name ' , TestClass::class, ClassDeclaredContext::ACCESS_PROTECTED );
46
47
$ pri = new PropertyContext ('name ' , TestClass::class, ClassDeclaredContext::ACCESS_PRIVATE );
47
48
49
+ $ child_pub = new PropertyContext ('name ' , ChildTestClass::class, ClassDeclaredContext::ACCESS_PUBLIC );
50
+ $ child_pro = new PropertyContext ('name ' , ChildTestClass::class, ClassDeclaredContext::ACCESS_PROTECTED );
51
+ $ child_pri = new PropertyContext ('name ' , ChildTestClass::class, ClassDeclaredContext::ACCESS_PRIVATE );
52
+
48
53
return [
49
54
'global public ' => [
50
55
$ pub ,
@@ -61,36 +66,54 @@ public function isAccessibleProvider()
61
66
null ,
62
67
false ,
63
68
],
64
- 'shared public ' => [
69
+ 'child public ' => [
65
70
$ pub ,
66
71
ChildTestClass::class,
67
72
true ,
68
73
],
69
- 'shared protected ' => [
74
+ 'child protected ' => [
70
75
$ pro ,
71
76
ChildTestClass::class,
72
77
true ,
73
78
],
74
- 'shared private ' => [
79
+ 'child private ' => [
75
80
$ pri ,
76
81
ChildTestClass::class,
77
82
false ,
78
83
],
79
- 'reverse shared public ' => [
80
- new PropertyContext ( ' name ' , ChildTestClass::class, ClassDeclaredContext:: ACCESS_PUBLIC ) ,
84
+ 'parent public ' => [
85
+ $ child_pub ,
81
86
TestClass::class,
82
87
true ,
83
88
],
84
- 'reverse shared protected ' => [
85
- new PropertyContext ( ' name ' , ChildTestClass::class, ClassDeclaredContext:: ACCESS_PROTECTED ) ,
89
+ 'parent protected ' => [
90
+ $ child_pro ,
86
91
TestClass::class,
87
92
true ,
88
93
],
89
- 'reverse shared private ' => [
90
- new PropertyContext ( ' name ' , ChildTestClass::class, ClassDeclaredContext:: ACCESS_PRIVATE ) ,
94
+ 'parent private ' => [
95
+ $ child_pri ,
91
96
TestClass::class,
92
97
false ,
93
98
],
99
+ // There is no need to test reverse siblings (ie. accessing an inherited property from
100
+ // a child of the parent that redeclared it) because then the declaring class of the
101
+ // property is the parent and we are identical to the 'child protected' test case
102
+ 'sibling public ' => [
103
+ $ child_pub ,
104
+ OtherChildTestClass::class,
105
+ true ,
106
+ ],
107
+ 'sibling protected ' => [
108
+ $ child_pro ,
109
+ OtherChildTestClass::class,
110
+ false ,
111
+ ],
112
+ 'sibling private ' => [
113
+ $ child_pri ,
114
+ OtherChildTestClass::class,
115
+ false ,
116
+ ],
94
117
'local public ' => [
95
118
$ pub ,
96
119
TestClass::class,
0 commit comments