]> granicus.if.org Git - php/commitdiff
- Add new tests
authorMarcus Boerger <helly@php.net>
Tue, 27 Sep 2005 08:37:37 +0000 (08:37 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 27 Sep 2005 08:37:37 +0000 (08:37 +0000)
tests/classes/tostring_002.phpt [new file with mode: 0755]
tests/classes/tostring_003.phpt [new file with mode: 0755]

diff --git a/tests/classes/tostring_002.phpt b/tests/classes/tostring_002.phpt
new file mode 100755 (executable)
index 0000000..8a4a7af
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST--
+ZE2 __toString() in __destruct
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
+--FILE--
+<?php
+
+class Test
+{
+       function __toString()
+       {
+               return "Hello\n";
+       }
+       
+       function __destruct()
+       {
+               echo $this;
+       }
+}
+
+$o = new Test;
+$o = NULL;
+
+$o = new Test;
+
+?>
+====DONE====
+--EXPECTF--
+Hello
+====DONE====
+Hello
diff --git a/tests/classes/tostring_003.phpt b/tests/classes/tostring_003.phpt
new file mode 100755 (executable)
index 0000000..0853de9
--- /dev/null
@@ -0,0 +1,36 @@
+--TEST--
+ZE2 __toString() in __destruct/exception
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
+--FILE--
+<?php
+
+class Test
+{
+       function __toString()
+       {
+               throw new Exception("Damn!");
+               return "Hello\n";
+       }
+       
+       function __destruct()
+       {
+               echo $this;
+       }
+}
+
+try
+{
+       $o = new Test;
+       $o = NULL;
+}
+catch(Exception $e)
+{
+       var_dump($e->getMessage());
+}
+
+?>
+====DONE====
+--EXPECTF--
+string(5) "Damn!"
+====DONE====