summaryrefslogtreecommitdiff
path: root/Zend/tests/traits/inheritance001.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/traits/inheritance001.phpt')
-rw-r--r--Zend/tests/traits/inheritance001.phpt24
1 files changed, 24 insertions, 0 deletions
diff --git a/Zend/tests/traits/inheritance001.phpt b/Zend/tests/traits/inheritance001.phpt
new file mode 100644
index 0000000..e8195c4
--- /dev/null
+++ b/Zend/tests/traits/inheritance001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Trait method overwridden by a method defined in the class.
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+trait HelloWorld {
+ public function sayHello() {
+ echo 'Hello World!';
+ }
+}
+
+class TheWorldIsNotEnough {
+ use HelloWorld;
+ public function sayHello() {
+ echo 'Hello Universe!';
+ }
+}
+
+$o = new TheWorldIsNotEnough();
+$o->sayHello(); // echos Hello Universe!
+?>
+--EXPECTF--
+Hello Universe! \ No newline at end of file