summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/tests/traits/static_001.phpt22
-rw-r--r--Zend/tests/traits/static_002.phpt23
-rw-r--r--Zend/tests/traits/static_003.phpt27
-rw-r--r--Zend/tests/traits/static_004.phpt22
-rw-r--r--Zend/tests/traits/static_forward_static_call.phpt28
-rw-r--r--Zend/tests/traits/static_get_called_class.phpt24
6 files changed, 146 insertions, 0 deletions
diff --git a/Zend/tests/traits/static_001.phpt b/Zend/tests/traits/static_001.phpt
new file mode 100644
index 0000000000..d86cb851b9
--- /dev/null
+++ b/Zend/tests/traits/static_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Traits with static methods.
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function test() {
+ return 'Test';
+ }
+ }
+
+ class A {
+ use TestTrait;
+ }
+
+ echo A::test();
+
+?>
+--EXPECT--
+Test \ No newline at end of file
diff --git a/Zend/tests/traits/static_002.phpt b/Zend/tests/traits/static_002.phpt
new file mode 100644
index 0000000000..c076085519
--- /dev/null
+++ b/Zend/tests/traits/static_002.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Traits with static methods referenced using variable.
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function test() {
+ return 'Test';
+ }
+ }
+
+ class A {
+ use TestTrait;
+ }
+
+ $class = "A";
+ echo $class::test();
+
+?>
+--EXPECT--
+Test \ No newline at end of file
diff --git a/Zend/tests/traits/static_003.phpt b/Zend/tests/traits/static_003.phpt
new file mode 100644
index 0000000000..fbe5421c71
--- /dev/null
+++ b/Zend/tests/traits/static_003.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Traits with late static bindings.
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function test() {
+ return static::$test;
+ }
+ }
+
+ class A {
+ use TestTrait;
+ protected static $test = "Test A";
+ }
+
+ class B extends A {
+ protected static $test = "Test B";
+ }
+
+ echo B::test();
+
+?>
+--EXPECT--
+Test B \ No newline at end of file
diff --git a/Zend/tests/traits/static_004.phpt b/Zend/tests/traits/static_004.phpt
new file mode 100644
index 0000000000..c360f457f0
--- /dev/null
+++ b/Zend/tests/traits/static_004.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Traits with __callStatic magic method.
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function __callStatic($name, $arguments) {
+ return $name;
+ }
+ }
+
+ class A {
+ use TestTrait;
+ }
+
+ echo A::Test();
+
+?>
+--EXPECT--
+Test \ No newline at end of file
diff --git a/Zend/tests/traits/static_forward_static_call.phpt b/Zend/tests/traits/static_forward_static_call.phpt
new file mode 100644
index 0000000000..878cf1fcc1
--- /dev/null
+++ b/Zend/tests/traits/static_forward_static_call.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Traits and forward_static_call().
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function test() {
+ return 'Forwarded '.forward_static_call(array('A', 'test'));
+ }
+ }
+
+ class A {
+ public static function test() {
+ return "Test A";
+ }
+ }
+
+ class B extends A {
+ use TestTrait;
+ }
+
+ echo B::test();
+
+?>
+--EXPECT--
+Forwarded Test A \ No newline at end of file
diff --git a/Zend/tests/traits/static_get_called_class.phpt b/Zend/tests/traits/static_get_called_class.phpt
new file mode 100644
index 0000000000..dc29ecefa2
--- /dev/null
+++ b/Zend/tests/traits/static_get_called_class.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Traits and get_called_class().
+--CREDITS--
+Simas Toleikis simast@gmail.com
+--FILE--
+<?php
+
+ trait TestTrait {
+ public static function test() {
+ return get_called_class();
+ }
+ }
+
+ class A {
+ use TestTrait;
+ }
+
+ class B extends A { }
+
+ echo B::test();
+
+?>
+--EXPECT--
+B \ No newline at end of file