Skip to content

Commit 6cad62b

Browse files
committed
Add dedicated test for anon class names
1 parent 891047e commit 6cad62b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Zend/tests/anon_class_name.phpt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Generated names for anonymous classes
3+
--FILE--
4+
<?php
5+
6+
namespace DeclaringNS {
7+
class Test1 {}
8+
interface Test2 {}
9+
interface Test3 {}
10+
}
11+
12+
namespace UsingNS {
13+
function print_name(object $obj) {
14+
echo strstr(get_class($obj), "\0", true), "\n";
15+
}
16+
17+
print_name(new class {});
18+
print_name(new class extends \DeclaringNS\Test1 {});
19+
print_name(new class extends \DeclaringNS\Test1 implements \DeclaringNS\Test2 {});
20+
print_name(new class implements \DeclaringNS\Test2 {});
21+
print_name(new class implements \DeclaringNS\Test2, \DeclaringNS\Test3 {});
22+
}
23+
24+
?>
25+
--EXPECT--
26+
class@anonymous
27+
DeclaringNS\Test1@anonymous
28+
DeclaringNS\Test1@anonymous
29+
DeclaringNS\Test2@anonymous
30+
DeclaringNS\Test2@anonymous

0 commit comments

Comments
 (0)