cvs: ZendEngine2 /tests access_modifiers_010.phpt errmsg_044.phpt foreach_002.phpt inter_03.phpt list_001.phpt list_002.phpt objects_019.phpt

[email protected] ("Felipe Pena")
Newsgroups php.zend-engine.cvs
Message-ID <cvsfelipe1205326919@cvsserver>
felipe		Wed Mar 12 13:01:59 2008 UTC

  Modified files:              
    /ZendEngine2/tests	access_modifiers_010.phpt errmsg_044.phpt 
                      	foreach_002.phpt inter_03.phpt list_001.phpt 
                      	list_002.phpt objects_019.phpt 
  Log:
  New tests
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/access_modifiers_010.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/access_modifiers_010.phpt
diff -u /dev/null ZendEngine2/tests/access_modifiers_010.phpt:1.2
--- /dev/null	Wed Mar 12 13:01:59 2008
+++ ZendEngine2/tests/access_modifiers_010.phpt	Wed Mar 12 13:01:59 2008
@@ -0,0 +1,31 @@
+--TEST--
+Testing visibility of methods
+--FILE--
+<?php
+
+class d {
+	private function test2() {
+		print "Bar\n";
+	}
+}
+
+abstract class a extends d {
+	public function test() {
+		$this->test2();
+	}
+}
+
+abstract class b extends a {
+}
+
+class c extends b {
+	public function __construct() {
+		$this->test();
+	}	
+}
+
+new c;
+
+?>
+--EXPECTF--
+Fatal error: Call to private method d::test2() from context 'a' in %s on line %d
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/errmsg_044.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/errmsg_044.phpt
diff -u /dev/null ZendEngine2/tests/errmsg_044.phpt:1.2
--- /dev/null	Wed Mar 12 13:01:59 2008
+++ ZendEngine2/tests/errmsg_044.phpt	Wed Mar 12 13:01:59 2008
@@ -0,0 +1,11 @@
+--TEST--
+Trying use object of type stdClass as array
+--FILE--
+<?php
+
+$a[0] = new stdclass;
+$a[0][0] = new stdclass;
+
+?>
+--EXPECT--
+Fatal error: Cannot use object of type stdClass as array in %s on line %d
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/foreach_002.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/foreach_002.phpt
diff -u /dev/null ZendEngine2/tests/foreach_002.phpt:1.2
--- /dev/null	Wed Mar 12 13:01:59 2008
+++ ZendEngine2/tests/foreach_002.phpt	Wed Mar 12 13:01:59 2008
@@ -0,0 +1,34 @@
+--TEST--
+Creating recursive array on foreach using same variable
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+foreach (($a = array('a' => array('a' => &$a))) as $a) {
+	var_dump($a);
+}
+
+?>
+--EXPECT--
+array(1) {
+  ["a"]=>
+  &array(1) {
+    ["a"]=>
+    &array(1) {
+      ["a"]=>
+      *RECURSION*
+    }
+  }
+}
+--UEXPECT--
+array(1) {
+  [u"a"]=>
+  &array(1) {
+    [u"a"]=>
+    &array(1) {
+      [u"a"]=>
+      *RECURSION*
+    }
+  }
+}
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/inter_03.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/inter_03.phpt
diff -u /dev/null ZendEngine2/tests/inter_03.phpt:1.2
--- /dev/null	Wed Mar 12 13:01:59 2008
+++ ZendEngine2/tests/inter_03.phpt	Wed Mar 12 13:01:59 2008
@@ -0,0 +1,19 @@
+--TEST--
+Testing interface constants with inheritance
+--FILE--
+<?php
+
+interface a {
+	const b = 2;	
+}
+
+interface b extends a {
+	const c = self::b;	
+}
+
+var_dump(b::c, a::b);
+
+?>
+--EXPECT--
+int(2)
+int(2)
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/list_001.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/list_001.phpt
diff -u /dev/null ZendEngine2/tests/list_001.phpt:1.2
--- /dev/null	Wed Mar 12 13:01:59 2008
+++ ZendEngine2/tests/list_001.phpt	Wed Mar 12 13:01:59 2008
@@ -0,0 +1,14 @@
+--TEST--
+"Nested" list()
+--FILE--
+<?php
+
+list($a, list($b)) = array(new stdclass, array(new stdclass));
+var_dump($a, $b);
+
+?>
+--EXPECT--
+object(stdClass)#1 (0) {
+}
+object(stdClass)#2 (0) {
+}
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/list_002.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/list_002.phpt
diff -u /dev/null ZendEngine2/tests/list_002.phpt:1.2
--- /dev/null	Wed Mar 12 13:01:59 2008
+++ ZendEngine2/tests/list_002.phpt	Wed Mar 12 13:01:59 2008
@@ -0,0 +1,20 @@
+--TEST--
+Testing full-reference on list()
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$a = new stdclass;
+$b =& $a;
+
+list($a, list($b)) = array($a, array($b));
+var_dump($a, $b, $a === $b);
+
+?>
+--EXPECT--
+object(stdClass)#1 (0) {
+}
+object(stdClass)#1 (0) {
+}
+bool(true)
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/objects_019.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/objects_019.phpt
diff -u /dev/null ZendEngine2/tests/objects_019.phpt:1.2
--- /dev/null	Wed Mar 12 13:01:59 2008
+++ ZendEngine2/tests/objects_019.phpt	Wed Mar 12 13:01:59 2008
@@ -0,0 +1,46 @@
+--TEST--
+Testing references of dynamic properties
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$foo = array(new stdclass, new stdclass);
+
+$foo[1]->a = &$foo[0]->a;
+$foo[0]->a = 2;
+
+$x = $foo[1]->a;
+$x = 'foo';
+
+var_dump($foo, $x);
+
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  object(stdClass)#1 (1) {
+    ["a"]=>
+    &int(2)
+  }
+  [1]=>
+  object(stdClass)#2 (1) {
+    ["a"]=>
+    &int(2)
+  }
+}
+string(3) "foo"
+--UEXPECT--
+array(2) {
+  [0]=>
+  object(stdClass)#1 (1) {
+    [u"a"]=>
+    &int(2)
+  }
+  [1]=>
+  object(stdClass)#2 (1) {
+    [u"a"]=>
+    &int(2)
+  }
+}
+unicode(3) "foo"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.