FAQ
dufuz Sat, 09 Jul 2011 23:35:34 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=313096

Log:
Add specific PEAR::isError tests

Changed paths:
A pear/pear-core/trunk/tests/PEAR/test_isError.phpt
A pear/pear-core/trunk/tests/PEAR/test_isError_failed.phpt

Added: pear/pear-core/trunk/tests/PEAR/test_isError.phpt
===================================================================
--- pear/pear-core/trunk/tests/PEAR/test_isError.phpt (rev 0)
+++ pear/pear-core/trunk/tests/PEAR/test_isError.phpt 2011-07-09 23:35:34 UTC (rev 313096)
@@ -0,0 +1,29 @@
+--TEST--
+PEAR::isError test
+--SKIPIF--
+<?php
+if (!getenv('PHP_PEAR_RUNTESTS')) {
+ echo 'skip';
+}
+?>
+--FILE--
+<?php
+require_once 'PEAR.php';
+
+$error = PEAR::throwError('test', 123, 'Wooop');
+var_dump(PEAR::isError($error));
+
+$error = PEAR::throwError('test', 123);
+var_dump(PEAR::isError($error));
+
+$error = PEAR::throwError('test');
+var_dump(PEAR::isError($error));
+
+$error = PEAR::throwError();
+var_dump(PEAR::isError($error));
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
\ No newline at end of file

Added: pear/pear-core/trunk/tests/PEAR/test_isError_failed.phpt
===================================================================
--- pear/pear-core/trunk/tests/PEAR/test_isError_failed.phpt (rev 0)
+++ pear/pear-core/trunk/tests/PEAR/test_isError_failed.phpt 2011-07-09 23:35:34 UTC (rev 313096)
@@ -0,0 +1,32 @@
+--TEST--
+PEAR::isError test failures
+--SKIPIF--
+<?php
+if (!getenv('PHP_PEAR_RUNTESTS')) {
+ echo 'skip';
+}
+?>
+--FILE--
+<?php
+require_once 'PEAR.php';
+
+var_dump(PEAR::isError('string'));
+var_dump(PEAR::isError(array()));
+var_dump(PEAR::isError(array('test')));
+var_dump(PEAR::isError(true));
+var_dump(PEAR::isError(false));
+var_dump(PEAR::isError(null));
+var_dump(PEAR::isError(10));
+var_dump(PEAR::isError(1.));
+var_dump(PEAR::isError(new stdClass));
+?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
\ No newline at end of file

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-core @
categoriesphp
postedJul 9, '11 at 11:35p
activeJul 9, '11 at 11:35p
posts1
users1
websitepear.php.net

1 user in discussion

Helgi Þormar Þorbjörnsson: 1 post

People

Translate

site design / logo © 2021 Grokbase