]> granicus.if.org Git - php/commitdiff
- Add new tests
authorMarcus Boerger <helly@php.net>
Sat, 23 Apr 2005 15:21:07 +0000 (15:21 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 23 Apr 2005 15:21:07 +0000 (15:21 +0000)
Zend/tests/bug29674.phpt [new file with mode: 0755]
Zend/tests/bug30161.phpt [new file with mode: 0755]
Zend/tests/bug30346.phpt [new file with mode: 0755]
ext/sqlite/tests/pdo/pdo_024.phpt [new file with mode: 0755]
tests/classes/__set__get_004.phpt [new file with mode: 0755]

diff --git a/Zend/tests/bug29674.phpt b/Zend/tests/bug29674.phpt
new file mode 100755 (executable)
index 0000000..aef91f4
--- /dev/null
@@ -0,0 +1,41 @@
+--TEST--
+Bug #29674 (inherited method doesn't have access to private variables of the derived class)
+--FILE--
+<?php
+
+class BaseClass
+{
+       private $private_base = "Base";
+       
+       function printVars ()
+       {
+               var_dump($this->private_base);
+               var_dump($this->private_child);
+       }
+}
+
+class ChildClass extends BaseClass
+{
+       private $private_child = "Child";
+}
+
+echo "===BASE===\n";
+$obj = new BaseClass;
+$obj->printVars();
+
+echo "===CHILD===\n";
+$obj = new ChildClass;
+$obj->printVars();
+
+?>
+===DONE===
+--EXPECTF--
+===BASE===
+string(4) "Base"
+
+Notice: Undefined property:  BaseClass::$private_child in %sbug29674.php on line %d
+NULL
+===CHILD===
+string(4) "Base"
+
+Fatal error: Cannot access private property ChildClass::$private_child in %sbug29674.php on line %d
diff --git a/Zend/tests/bug30161.phpt b/Zend/tests/bug30161.phpt
new file mode 100755 (executable)
index 0000000..038a151
--- /dev/null
@@ -0,0 +1,33 @@
+--TEST--
+Bug #30161 (Segmentation fault with exceptions)
+--FILE--
+<?php
+class FIIFO {
+
+        public function __construct() {
+                throw new Exception;
+        }
+
+}
+
+class hariCow extends FIIFO {
+
+        public function __construct() {
+                try {
+                        parent::__construct();
+                } catch(Exception $e) {
+                }
+        }
+        
+        public function __toString() {
+                return "Rusticus in asino sedet.";
+        }
+
+}
+
+
+$db = new hariCow;
+
+echo $db;
+?>
+--EXPECT--
diff --git a/Zend/tests/bug30346.phpt b/Zend/tests/bug30346.phpt
new file mode 100755 (executable)
index 0000000..a158d0c
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+Bug 30346 (arrayAcces & using $this)
+--FILE--
+<?php
+
+class Test implements ArrayAccess
+{
+        public function __construct() { }       
+        public function offsetExists( $offset ) { return false; }
+        public function offsetGet( $offset ) { return $offset; }
+        public function offsetSet( $offset, $data ) { }
+        public function offsetUnset( $offset ) { }
+}
+
+$post = new Test;
+$id = 'page';
+echo $post[$id.'_show'];
+echo "\n";
+
+?>
+===DONE===
+--EXPECT--
+page_show
+===DONE===
\ No newline at end of file
diff --git a/ext/sqlite/tests/pdo/pdo_024.phpt b/ext/sqlite/tests/pdo/pdo_024.phpt
new file mode 100755 (executable)
index 0000000..52a1686
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+PDO_SQLite2: Bind does not convert NULL
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+require_once($PDO_TESTS . 'pdo_024.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+bind: success
+bool(true)
+NULL
+===DONE===
diff --git a/tests/classes/__set__get_004.phpt b/tests/classes/__set__get_004.phpt
new file mode 100755 (executable)
index 0000000..e3061da
--- /dev/null
@@ -0,0 +1,39 @@
+--TEST--
+ZE2 __set() and __get()
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
+--FILE--
+<?php
+class Test {
+       protected $x;
+
+       function __get($name) {
+               if (isset($this->x[$name])) {
+                       return $this->x[$name];
+               } 
+               else
+               {
+                       return NULL;
+               }
+       }
+
+       function __set($name, $val) {
+               $this->x[$name] = $val;
+       }
+}
+
+$foo = new Test();
+$bar = new Test();
+$bar->baz = "Check";
+
+$foo->bar = $bar;
+
+var_dump($bar->baz);
+var_dump($foo->bar->baz);
+
+?>
+===DONE===
+--EXPECTF--
+string(5) "Check"
+string(5) "Check"
+===DONE===