added $this in constructor test (fails currently)

This commit is contained in:
Andre Langhorst 2000-12-06 17:56:53 +00:00
parent 7e28784de3
commit 45c218968c

33
tests/lang/030.phpt Normal file
View File

@ -0,0 +1,33 @@
--TEST--
$this in constructor test
--POST--
--GET--
--FILE--
<?php
class foo {
function foo($name) {
$GLOBALS['List']= &$this;
$this->Name = $name;
$GLOBALS['List']->echoName(); }
function echoName() {
$GLOBALS['names'][]=$this->Name; } }
function &foo2(&$foo) {
return $foo; }
$bar1 = new foo('constructor');
$bar1->Name = 'outside';
$bar1->echoName();
$bar1 = foo2(new foo('constructor'));
$bar1->Name = 'outside';
$bar1->echoName();
$List->echoName();
print ($names==array('constructor','constructor','constructor','constructor','constructor')) ? 'success:':'failure';
?>
--EXPECT--
success