]> granicus.if.org Git - php/commitdiff
added $this in constructor test (fails currently)
authorAndre Langhorst <waldschrott@php.net>
Wed, 6 Dec 2000 17:56:53 +0000 (17:56 +0000)
committerAndre Langhorst <waldschrott@php.net>
Wed, 6 Dec 2000 17:56:53 +0000 (17:56 +0000)
tests/lang/030.phpt [new file with mode: 0644]

diff --git a/tests/lang/030.phpt b/tests/lang/030.phpt
new file mode 100644 (file)
index 0000000..9215404
--- /dev/null
@@ -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