summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/traits005.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/reflection/tests/traits005.phpt')
-rw-r--r--ext/reflection/tests/traits005.phpt41
1 files changed, 41 insertions, 0 deletions
diff --git a/ext/reflection/tests/traits005.phpt b/ext/reflection/tests/traits005.phpt
new file mode 100644
index 0000000..1496a35
--- /dev/null
+++ b/ext/reflection/tests/traits005.phpt
@@ -0,0 +1,41 @@
+--TEST--
+ReflectionClass::getTraitAlias
+--FILE--
+<?php
+trait T1 { function m1() { } function m2() { } }
+
+class C1 { }
+class C2 { use T1; }
+class C3 { use T1 { m1 as a1; } }
+class C4 { use T1 { m1 as a1; m2 as a2; } }
+
+for ($c = "C1"; $c <= "C4"; $c++) {
+ echo "class $c:\n";
+ $r = new ReflectionClass($c);
+ var_dump($r->getTraitAliases());
+ echo "\n";
+}
+?>
+--EXPECT--
+class C1:
+array(0) {
+}
+
+class C2:
+array(0) {
+}
+
+class C3:
+array(1) {
+ ["a1"]=>
+ string(10) "(null)::m1"
+}
+
+class C4:
+array(2) {
+ ["a1"]=>
+ string(10) "(null)::m1"
+ ["a2"]=>
+ string(10) "(null)::m2"
+}
+