From d4245df7d678343bcd1b314c5400e1fc0193728f Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Fri, 18 Apr 2008 13:54:46 +0000 Subject: [PATCH] - New tests --- Zend/tests/024.phpt | 51 ++++++++++++++++++++++ Zend/tests/025.phpt | 32 ++++++++++++++ Zend/tests/026.phpt | 25 +++++++++++ Zend/tests/027.phpt | 22 ++++++++++ Zend/tests/028.phpt | 23 ++++++++++ Zend/tests/029.phpt | 85 ++++++++++++++++++++++++++++++++++++ Zend/tests/030.phpt | 104 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 342 insertions(+) create mode 100644 Zend/tests/024.phpt create mode 100644 Zend/tests/025.phpt create mode 100644 Zend/tests/026.phpt create mode 100644 Zend/tests/027.phpt create mode 100644 Zend/tests/028.phpt create mode 100644 Zend/tests/029.phpt create mode 100644 Zend/tests/030.phpt diff --git a/Zend/tests/024.phpt b/Zend/tests/024.phpt new file mode 100644 index 0000000000..6fe10201f5 --- /dev/null +++ b/Zend/tests/024.phpt @@ -0,0 +1,51 @@ +--TEST-- +Testing operations with undefined variable +--FILE-- +$b); +var_dump($a->$b); +var_dump($a->$b->$c[1]); + +?> +--EXPECTF-- +Notice: Undefined variable: a in %s on line %d +NULL + +Notice: Undefined variable: c in %s on line %d + +Notice: Undefined variable: a in %s on line %d +NULL + +Notice: Undefined variable: a in %s on line %d +int(1) + +Notice: Undefined variable: b in %s on line %d + +Notice: Undefined variable: a in %s on line %d +int(0) + +Notice: Undefined variable: a in %s on line %d +NULL + +Notice: Undefined variable: b in %s on line %d +int(1) + +Notice: Trying to get property of non-object in %s on line %d +NULL + +Notice: Trying to get property of non-object in %s on line %d +NULL + +Notice: Undefined variable: c in %s on line %d + +Notice: Trying to get property of non-object in %s on line %d + +Notice: Trying to get property of non-object in %s on line %d +NULL diff --git a/Zend/tests/025.phpt b/Zend/tests/025.phpt new file mode 100644 index 0000000000..24e5520ee1 --- /dev/null +++ b/Zend/tests/025.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing dynamic calls +--FILE-- + +--EXPECT-- +ok +ok +ok +ok +ok +ok diff --git a/Zend/tests/026.phpt b/Zend/tests/026.phpt new file mode 100644 index 0000000000..784b12c69b --- /dev/null +++ b/Zend/tests/026.phpt @@ -0,0 +1,25 @@ +--TEST-- +Trying assign value to property when an object is not returned in a function +--FILE-- +a()->a; +print "ok\n"; + +$test->a()->a = 1; +print "ok\n"; + +?> +--EXPECTF-- +Notice: Trying to get property of non-object in %s on line %d +ok + +Strict Standards: Creating default object from empty value in %s on line %d +ok diff --git a/Zend/tests/027.phpt b/Zend/tests/027.phpt new file mode 100644 index 0000000000..a862d689e1 --- /dev/null +++ b/Zend/tests/027.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing dynamic calls using variable variables with curly syntax +--FILE-- + +--EXPECT-- +bool(true) +bool(true) diff --git a/Zend/tests/028.phpt b/Zend/tests/028.phpt new file mode 100644 index 0000000000..2c58a87b32 --- /dev/null +++ b/Zend/tests/028.phpt @@ -0,0 +1,23 @@ +--TEST-- +Testing function call through of array item +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) +bool(true) + +Notice: Undefined offset: 2 in %s on line %d + +Fatal error: Function name must be a string in %s on line %d diff --git a/Zend/tests/029.phpt b/Zend/tests/029.phpt new file mode 100644 index 0000000000..469dd081bb --- /dev/null +++ b/Zend/tests/029.phpt @@ -0,0 +1,85 @@ +--TEST-- +Testing assign to property of an object in an array +--FILE-- +a = clone $arr[0]; +var_dump($arr); + +$arr[0]->b = new $arr[0]; +var_dump($arr); + +$arr[0]->c = $arr[0]->a; +var_dump($arr); + +?> +--EXPECT-- +array(1) { + [0]=> + object(stdClass)#1 (1) { + ["a"]=> + object(stdClass)#2 (0) { + } + } +} +array(1) { + [0]=> + object(stdClass)#1 (2) { + ["a"]=> + object(stdClass)#2 (0) { + } + ["b"]=> + object(stdClass)#3 (0) { + } + } +} +array(1) { + [0]=> + object(stdClass)#1 (3) { + ["a"]=> + object(stdClass)#2 (0) { + } + ["b"]=> + object(stdClass)#3 (0) { + } + ["c"]=> + object(stdClass)#2 (0) { + } + } +} +--UEXPECT-- +array(1) { + [0]=> + object(stdClass)#1 (1) { + [u"a"]=> + object(stdClass)#2 (0) { + } + } +} +array(1) { + [0]=> + object(stdClass)#1 (2) { + [u"a"]=> + object(stdClass)#2 (0) { + } + [u"b"]=> + object(stdClass)#3 (0) { + } + } +} +array(1) { + [0]=> + object(stdClass)#1 (3) { + [u"a"]=> + object(stdClass)#2 (0) { + } + [u"b"]=> + object(stdClass)#3 (0) { + } + [u"c"]=> + object(stdClass)#2 (0) { + } + } +} diff --git a/Zend/tests/030.phpt b/Zend/tests/030.phpt new file mode 100644 index 0000000000..f6af9c0584 --- /dev/null +++ b/Zend/tests/030.phpt @@ -0,0 +1,104 @@ +--TEST-- +Overriding $this in catch and checking the object properties later. +--FILE-- +baz(); + } + + public function baz() { + foreach ($this as $k => $v) { + printf("'%s' => '%s'\n", $k, $v); + } + print "ok\n"; + } +} + +$test = new foo; +$test->bar(); + +?> +--EXPECTF-- +object(Exception)#2 (6) { + ["message":protected]=> + string(3) "foo" + ["string":"Exception":private]=> + string(0) "" + ["code":protected]=> + int(0) + ["file":protected]=> + string(%d) "%s" + ["line":protected]=> + int(%d) + ["trace":"Exception":private]=> + array(1) { + [0]=> + array(6) { + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) + ["function"]=> + string(3) "bar" + ["class"]=> + string(3) "foo" + ["type"]=> + string(2) "->" + ["args"]=> + array(0) { + } + } + } +} +'test' => '0' +'test_2' => '1' +'test_3' => '2' +ok +--UEXPECTF-- +object(Exception)#2 (6) { + ["message":protected]=> + string(3) "foo" + ["string":"Exception":private]=> + string(0) "" + ["code":protected]=> + int(0) + ["file":protected]=> + string(32) "%s" + ["line":protected]=> + int(%d) + ["trace":"Exception":private]=> + array(1) { + [0]=> + array(6) { + ["file"]=> + string(32) "%s" + ["line"]=> + int(%d) + ["function"]=> + string(3) "bar" + ["class"]=> + string(3) "foo" + ["type"]=> + string(2) "->" + ["args"]=> + array(0) { + } + } + } +} +'test' => '0' +'test_2' => '1' +'test_3' => '2' +ok -- 2.50.1