felipe                                   Thu, 06 May 2010 19:21:11 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299091

Log:
- New tests

Changed paths:
    A   php/php-src/trunk/Zend/tests/traits/error_010.phpt
    A   php/php-src/trunk/Zend/tests/traits/error_011.phpt
    A   php/php-src/trunk/Zend/tests/traits/error_012.phpt
    A   php/php-src/trunk/Zend/tests/traits/error_013.phpt
    A   php/php-src/trunk/Zend/tests/traits/error_014.phpt
    A   php/php-src/trunk/Zend/tests/traits/error_015.phpt

Added: php/php-src/trunk/Zend/tests/traits/error_010.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/error_010.phpt                          
(rev 0)
+++ php/php-src/trunk/Zend/tests/traits/error_010.phpt  2010-05-06 19:21:11 UTC 
(rev 299091)
@@ -0,0 +1,27 @@
+--TEST--
+Trying to exclude trait method multiple times
+--FILE--
+<?php
+
+trait foo {
+       public function test() { return 3; }
+}
+trait c {
+       public function test() { return 2; }
+}
+
+trait b {
+       public function test() { return 1; }
+}
+
+class bar {
+       use foo, c { c::test insteadof foo, b; }
+       use foo, c { c::test insteadof foo, b; }
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Fatal error: Failed to evaluate a trait precedence (test). Method of trait foo 
was defined to be excluded multiple times in %s on line %d


Property changes on: php/php-src/trunk/Zend/tests/traits/error_010.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Added: php/php-src/trunk/Zend/tests/traits/error_011.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/error_011.phpt                          
(rev 0)
+++ php/php-src/trunk/Zend/tests/traits/error_011.phpt  2010-05-06 19:21:11 UTC 
(rev 299091)
@@ -0,0 +1,28 @@
+--TEST--
+Testing trait collisions
+--FILE--
+<?php
+
+trait foo {
+       public function test() { return 3; }
+}
+trait c {
+       public function test() { return 2; }
+}
+
+trait b {
+       public function test() { return 1; }
+}
+
+class bar {
+       use foo, c, b;
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Warning: Trait method test has not been applied, because there are collisions 
with other trait methods on bar in %s on line %d
+
+Fatal error: Call to undefined method bar::test() in %s on line %d


Property changes on: php/php-src/trunk/Zend/tests/traits/error_011.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Added: php/php-src/trunk/Zend/tests/traits/error_012.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/error_012.phpt                          
(rev 0)
+++ php/php-src/trunk/Zend/tests/traits/error_012.phpt  2010-05-06 19:21:11 UTC 
(rev 299091)
@@ -0,0 +1,19 @@
+--TEST--
+Trying to access a protected trait method
+--FILE--
+<?php
+
+trait foo {
+       public function test() { return 3; }
+}
+
+class bar {
+       use foo { test as protected; }
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Fatal error: Call to protected method bar::test() from context '' in %s on 
line %d


Property changes on: php/php-src/trunk/Zend/tests/traits/error_012.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Added: php/php-src/trunk/Zend/tests/traits/error_013.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/error_013.phpt                          
(rev 0)
+++ php/php-src/trunk/Zend/tests/traits/error_013.phpt  2010-05-06 19:21:11 UTC 
(rev 299091)
@@ -0,0 +1,19 @@
+--TEST--
+Trying to use static as method modifier
+--FILE--
+<?php
+
+trait foo {
+       public function test() { return 3; }
+}
+
+class bar {
+       use foo { test as static; }
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Fatal error: Cannot use 'static' as method modifier in %s on line %d


Property changes on: php/php-src/trunk/Zend/tests/traits/error_013.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Added: php/php-src/trunk/Zend/tests/traits/error_014.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/error_014.phpt                          
(rev 0)
+++ php/php-src/trunk/Zend/tests/traits/error_014.phpt  2010-05-06 19:21:11 UTC 
(rev 299091)
@@ -0,0 +1,23 @@
+--TEST--
+Trying to override final method
+--FILE--
+<?php
+
+trait foo {
+       public function test() { return 3; }
+}
+
+class baz {
+       final public function test() { return 4; }
+}
+
+class bar extends baz {
+       use foo { test as public; }
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Fatal error: Cannot override final method baz::test() in %s on line %d


Property changes on: php/php-src/trunk/Zend/tests/traits/error_014.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Added: php/php-src/trunk/Zend/tests/traits/error_015.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/error_015.phpt                          
(rev 0)
+++ php/php-src/trunk/Zend/tests/traits/error_015.phpt  2010-05-06 19:21:11 UTC 
(rev 299091)
@@ -0,0 +1,25 @@
+--TEST--
+Trying to add an alias to a trait method where there is another with same name
+--FILE--
+<?php
+
+trait foo {
+       public function test() { return 3; }
+}
+
+trait baz {
+       public function test() { return 4; }
+}
+
+class bar {
+       use foo, baz {
+               baz::test as zzz;
+       }
+}
+
+$x = new bar;
+var_dump($x->test());
+
+?>
+--EXPECTF--
+Fatal error: Failed to add aliased trait method (zzz) to trait table. Probably 
there is already a trait method with same name in %s on line %d


Property changes on: php/php-src/trunk/Zend/tests/traits/error_015.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to