From 863cd369b961ed7c5067f272b11e93b5030ca2ba Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 12 Mar 2008 13:01:59 +0000 Subject: [PATCH] New tests --- Zend/tests/access_modifiers_010.phpt | 31 +++++++++++++++++++ Zend/tests/errmsg_044.phpt | 11 +++++++ Zend/tests/foreach_002.phpt | 34 ++++++++++++++++++++ Zend/tests/inter_03.phpt | 19 ++++++++++++ Zend/tests/list_001.phpt | 14 +++++++++ Zend/tests/list_002.phpt | 20 ++++++++++++ Zend/tests/objects_019.phpt | 46 ++++++++++++++++++++++++++++ 7 files changed, 175 insertions(+) create mode 100644 Zend/tests/access_modifiers_010.phpt create mode 100644 Zend/tests/errmsg_044.phpt create mode 100644 Zend/tests/foreach_002.phpt create mode 100644 Zend/tests/inter_03.phpt create mode 100644 Zend/tests/list_001.phpt create mode 100644 Zend/tests/list_002.phpt create mode 100644 Zend/tests/objects_019.phpt 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-- +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-- + +--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..a451b41dbe --- /dev/null +++ b/Zend/tests/foreach_002.phpt @@ -0,0 +1,34 @@ +--TEST-- +Creating recursive array on foreach using same variable +--FILE-- + 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* + } + } +} 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-- + +--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-- + +--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-- + +--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..27d101d773 --- /dev/null +++ b/Zend/tests/objects_019.phpt @@ -0,0 +1,46 @@ +--TEST-- +Testing references of dynamic properties +--FILE-- +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" -- 2.40.0