]> granicus.if.org Git - php/commitdiff
Add a couple of tests
authorZeev Suraski <zeev@php.net>
Mon, 21 Jul 2003 11:48:37 +0000 (11:48 +0000)
committerZeev Suraski <zeev@php.net>
Mon, 21 Jul 2003 11:48:37 +0000 (11:48 +0000)
tests/lang/036.phpt [new file with mode: 0755]
tests/lang/037.phpt [new file with mode: 0755]

diff --git a/tests/lang/036.phpt b/tests/lang/036.phpt
new file mode 100755 (executable)
index 0000000..474316e
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Child public element should not override parent private element in parent methods
+--FILE--
+<?php
+class par {
+       private $id = "foo";
+
+       function displayMe()
+       {
+               print $this->id;
+       }
+};
+
+class chld extends par {
+       public $id = "bar";
+       function displayHim()
+       {
+               parent::displayMe();
+       }
+};
+
+
+$obj = new chld();
+$obj->displayHim();
+?>
+--EXPECT--
+foo
diff --git a/tests/lang/037.phpt b/tests/lang/037.phpt
new file mode 100755 (executable)
index 0000000..c2a1ee3
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+'Static' binding for private variables
+--FILE--
+<?php
+
+class par {
+       private $id="foo";
+
+       function displayMe()
+       {
+               $this->displayChild();
+       }
+};
+
+class chld extends par {
+       private $id = "bar";
+
+       function displayChild()
+       {
+               print $this->id;
+       }
+};
+
+
+$obj = new chld();
+$obj->displayMe();
+
+?>
+--EXPECT--
+bar