- New tests

This commit is contained in:
Felipe Pena 2008-05-07 14:08:41 +00:00
parent 37691b0cd0
commit 3264ac20bf
2 changed files with 88 additions and 0 deletions

49
Zend/tests/ns_064.phpt Normal file
View File

@ -0,0 +1,49 @@
--TEST--
Magic methods in overrided stdClass inside namespace
--FILE--
<?php
namespace test;
class foo {
public $e = array();
public function __construct() {
$this->e[] = $this;
}
public function __set($a, $b) {
var_dump($a, $b);
}
public function __get($a) {
var_dump($a);
return $this;
}
}
use test::foo as stdClass;
$x = new stdClass;
$x->a = 1;
$x->b->c = 1;
$x->d->e[0]->f = 2;
?>
--EXPECT--
string(1) "a"
int(1)
string(1) "b"
string(1) "c"
int(1)
string(1) "d"
string(1) "f"
int(2)
--UEXPECT--
unicode(1) "a"
int(1)
unicode(1) "b"
unicode(1) "c"
int(1)
unicode(1) "d"
unicode(1) "f"
int(2)

View File

@ -0,0 +1,39 @@
--TEST--
Testing magic methods __set, __get and __call in cascade
--FILE--
<?php
class test {
static public $i = 0;
public function __construct() {
self::$i++;
}
public function __set($a, $b) {
return x();
}
public function __get($a) {
return x();
}
public function __call($a, $b) {
return x();
}
}
function x() {
return new test;
}
x()
->a
->b()
->c = 1;
var_dump(test::$i);
?>
--EXPECT--
int(4)