Skip to content

Commit dfb68fe

Browse files
mvoriseknikic
authored andcommitted
Remove XFAIL from sibling method call test
1 parent de41d6b commit dfb68fe

File tree

2 files changed

+88
-17
lines changed

2 files changed

+88
-17
lines changed

Zend/tests/access_modifiers_008.phpt

+46-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,60 @@
11
--TEST--
22
Inconsistencies when accessing protected members
3-
--XFAIL--
4-
Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
53
--FILE--
64
<?php
75

86
class A {
9-
static protected function f() {return 'A::f()';}
7+
static protected function ma() {
8+
return 'A::ma()';
9+
}
10+
11+
static private function mp() {
12+
return 'A::mp()';
13+
}
1014
}
15+
1116
class B1 extends A {
12-
static protected function f() {return 'B1::f()';}
17+
static protected function ma() {
18+
return 'B1::ma()';
19+
}
20+
21+
static protected function mp() {
22+
return 'B1::mp()';
23+
}
24+
25+
static protected function mb() {
26+
return 'B1::mb()';
27+
}
1328
}
29+
1430
class B2 extends A {
15-
static public function test() {echo B1::f();}
31+
static public function test() {
32+
echo A::ma() . "\n";
33+
try {
34+
echo A::mp() . "\n";
35+
} catch (\Throwable $e) {
36+
echo $e->getMessage() . "\n";
37+
}
38+
echo B1::ma() . "\n"; // protected method defined also in A
39+
try {
40+
echo B1::mp() . "\n"; // protected method defined also in A but as private
41+
} catch (\Throwable $e) {
42+
echo $e->getMessage() . "\n";
43+
}
44+
try {
45+
echo B1::mb() . "\n";
46+
} catch (\Throwable $e) {
47+
echo $e->getMessage() . "\n";
48+
}
49+
}
1650
}
51+
1752
B2::test();
1853

1954
?>
20-
--EXPECTF--
21-
Fatal error: Call to protected method B1::f() from scope B2 in %s on line %d
55+
--EXPECT--
56+
A::ma()
57+
Call to private method A::mp() from scope B2
58+
B1::ma()
59+
Call to protected method B1::mp() from scope B2
60+
Call to protected method B1::mb() from scope B2

Zend/tests/access_modifiers_009.phpt

+42-10
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,58 @@
11
--TEST--
2-
Inconsistencies when accessing protected members - 2
3-
--XFAIL--
4-
Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
2+
Inconsistencies when accessing protected members - is_callable
53
--FILE--
64
<?php
75

86
class A {
9-
static protected function f() {return 'A::f()';}
7+
static protected function ma() {
8+
return 'A::ma()';
9+
}
10+
11+
static private function mp() {
12+
return 'A::mp()';
13+
}
1014
}
15+
1116
class B1 extends A {
12-
static protected function f() {return 'B1::f()';}
17+
static protected function ma() {
18+
return 'B1::ma()';
19+
}
20+
21+
static protected function mp() {
22+
return 'B1::mp()';
23+
}
24+
25+
static protected function mb() {
26+
return 'B1::mb()';
27+
}
1328
}
29+
1430
class B2 extends A {
1531
static public function test() {
16-
var_dump(is_callable('B1::f'));
17-
B1::f();
32+
var_dump(is_callable('A::ma'));
33+
var_dump(is_callable('A::mp'));
34+
var_dump(is_callable('B1::ma')); // protected method defined also in A
35+
var_dump(is_callable('B1::mp')); // protected method defined also in A but as private
36+
var_dump(is_callable('B1::mb'));
1837
}
1938
}
39+
40+
var_dump(is_callable('B2::ma'));
41+
var_dump(is_callable('B2::mp'));
42+
var_dump(is_callable('B2::mb'));
43+
var_dump(is_callable('B2::test'));
44+
echo '----' . "\n";
2045
B2::test();
2146

2247
?>
23-
--EXPECTF--
48+
--EXPECT--
49+
bool(false)
50+
bool(false)
51+
bool(false)
52+
bool(true)
53+
----
54+
bool(true)
55+
bool(false)
56+
bool(true)
57+
bool(false)
2458
bool(false)
25-
26-
Fatal error: Call to protected method B1::f() from scope B2 in %s on line %d

0 commit comments

Comments
 (0)