]> granicus.if.org Git - php/commitdiff
- New tests
authorFelipe Pena <felipe@php.net>
Thu, 6 May 2010 15:49:58 +0000 (15:49 +0000)
committerFelipe Pena <felipe@php.net>
Thu, 6 May 2010 15:49:58 +0000 (15:49 +0000)
Zend/tests/traits/get_declared_traits_001.phpt [new file with mode: 0644]
Zend/tests/traits/get_declared_traits_002.phpt [new file with mode: 0644]
Zend/tests/traits/get_declared_traits_003.phpt [new file with mode: 0644]

diff --git a/Zend/tests/traits/get_declared_traits_001.phpt b/Zend/tests/traits/get_declared_traits_001.phpt
new file mode 100644 (file)
index 0000000..91f6b3d
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Testing get_declared_traits()
+--FILE--
+<?php
+
+class a { }
+interface b { }
+trait c { }
+abstract class d { }
+final class e { }
+
+var_dump(get_declared_traits());
+
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  string(1) "c"
+}
diff --git a/Zend/tests/traits/get_declared_traits_002.phpt b/Zend/tests/traits/get_declared_traits_002.phpt
new file mode 100644 (file)
index 0000000..74fdcc4
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Testing get_declared_traits() inside namespace
+--FILE--
+<?php
+
+namespace test {
+       class a { }
+       interface b { }
+       trait c { }
+       abstract class d { }
+       final class e { }
+       var_dump(get_declared_traits());
+}
+
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  string(6) "test\c"
+}
diff --git a/Zend/tests/traits/get_declared_traits_003.phpt b/Zend/tests/traits/get_declared_traits_003.phpt
new file mode 100644 (file)
index 0000000..4a68746
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Testing get_declared_classes() and get_declared_traits()
+--FILE--
+<?php
+
+class a { }
+interface b { }
+trait c { }
+abstract class d { }
+final class e { }
+var_dump(get_declared_classes());
+var_dump(get_declared_traits());
+
+?>
+--EXPECTF--
+%astring(1) "a"
+  [%d]=>
+  string(1) "d"
+  [%d]=>
+  string(1) "e"
+}
+array(1) {
+  [0]=>
+  string(1) "c"
+}