summaryrefslogtreecommitdiff
path: root/Zend/tests/traits/language008b.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/traits/language008b.phpt')
-rw-r--r--Zend/tests/traits/language008b.phpt30
1 files changed, 30 insertions, 0 deletions
diff --git a/Zend/tests/traits/language008b.phpt b/Zend/tests/traits/language008b.phpt
new file mode 100644
index 0000000000..9abbdbeb0d
--- /dev/null
+++ b/Zend/tests/traits/language008b.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Visibility can be changed with the as aliasing construct as well.
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+trait HelloWorld {
+ public function sayHello() {
+ echo 'Hello World!';
+ }
+}
+
+class MyClass {
+ use HelloWorld { sayHello as private sayHelloWorld; }
+
+ public function callPrivateAlias() {
+ $this->sayHelloWorld();
+ }
+}
+
+$o = new MyClass();
+$o->sayHello();
+$o->callPrivateAlias();
+$o->sayHelloWorld();
+
+
+?>
+--EXPECTF--
+Hello World!Hello World!
+Fatal error: Call to private method MyClass::sayHelloWorld() from context '' in %s on line %d \ No newline at end of file