diff options
author | Felipe Pena <felipe@php.net> | 2008-03-12 12:58:12 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2008-03-12 12:58:12 +0000 |
commit | 5fa8f63a01fd6cc72c90dd50b7660505fbcce327 (patch) | |
tree | a3087e4b5fcb9bb3cb0bdb76ea0eae06b7c6de02 /Zend/tests | |
parent | d269b5fd50837edaf3db9a1442f3ae27b8f9d00e (diff) | |
download | php-git-5fa8f63a01fd6cc72c90dd50b7660505fbcce327.tar.gz |
New tests
Diffstat (limited to 'Zend/tests')
-rw-r--r-- | Zend/tests/access_modifiers_010.phpt | 31 | ||||
-rw-r--r-- | Zend/tests/errmsg_044.phpt | 11 | ||||
-rw-r--r-- | Zend/tests/foreach_002.phpt | 23 | ||||
-rw-r--r-- | Zend/tests/inter_03.phpt | 19 | ||||
-rw-r--r-- | Zend/tests/list_001.phpt | 14 | ||||
-rw-r--r-- | Zend/tests/list_002.phpt | 20 | ||||
-rw-r--r-- | Zend/tests/objects_019.phpt | 32 |
7 files changed, 150 insertions, 0 deletions
diff --git a/Zend/tests/access_modifiers_010.phpt b/Zend/tests/access_modifiers_010.phpt new file mode 100644 index 0000000000..637ea36ce9 --- /dev/null +++ b/Zend/tests/access_modifiers_010.phpt @@ -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 diff --git a/Zend/tests/errmsg_044.phpt b/Zend/tests/errmsg_044.phpt new file mode 100644 index 0000000000..78a85f8b60 --- /dev/null +++ b/Zend/tests/errmsg_044.phpt @@ -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 diff --git a/Zend/tests/foreach_002.phpt b/Zend/tests/foreach_002.phpt new file mode 100644 index 0000000000..643e653927 --- /dev/null +++ b/Zend/tests/foreach_002.phpt @@ -0,0 +1,23 @@ +--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* + } + } +} diff --git a/Zend/tests/inter_03.phpt b/Zend/tests/inter_03.phpt new file mode 100644 index 0000000000..c91f4aa142 --- /dev/null +++ b/Zend/tests/inter_03.phpt @@ -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) diff --git a/Zend/tests/list_001.phpt b/Zend/tests/list_001.phpt new file mode 100644 index 0000000000..a9fff55004 --- /dev/null +++ b/Zend/tests/list_001.phpt @@ -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) { +} diff --git a/Zend/tests/list_002.phpt b/Zend/tests/list_002.phpt new file mode 100644 index 0000000000..ac0d8974be --- /dev/null +++ b/Zend/tests/list_002.phpt @@ -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) diff --git a/Zend/tests/objects_019.phpt b/Zend/tests/objects_019.phpt new file mode 100644 index 0000000000..53889edfab --- /dev/null +++ b/Zend/tests/objects_019.phpt @@ -0,0 +1,32 @@ +--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" |