]> git.mxchange.org Git - core.git/blobdiff - inc/classes/third_party/php_mailer/test/phpunit.php
PHPMailer updated to latest version 2.3
[core.git] / inc / classes / third_party / php_mailer / test / phpunit.php
index 1d508680cc4d9fb753296d687c20a4a8cec3468b..e0af5e69e9b28593152e5699ff2855af211b7dad 100644 (file)
@@ -5,7 +5,7 @@
 // Written by Fred Yankowski <fred@ontosys.com>\r
 //            OntoSys, Inc  <http://www.OntoSys.com>\r
 //\r
-// $Id: phpunit.php,v 1.1 2002/03/30 19:32:17 bmatzelle Exp $\r
+// $Id$\r
 \r
 // Copyright (c) 2000 Fred Yankowski\r
 \r
@@ -30,7 +30,7 @@
 // SOFTWARE.\r
 //\r
 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE |\r
-               E_CORE_ERROR | E_CORE_WARNING);\r
+    E_CORE_ERROR | E_CORE_WARNING);\r
 \r
 /*\r
 interface Test {\r
@@ -46,11 +46,13 @@ function trace($msg) {
 }\r
 \r
 \r
-class Exception {\r
+class phpUnitException {\r
     /* Emulate a Java exception, sort of... */\r
   var $message;\r
-  function Exception($message) {\r
+  var $type;\r
+  function phpUnitException($message, $type = 'FAILURE') {\r
     $this->message = $message;\r
+    $this->type = $type;\r
   }\r
   function getMessage() {\r
     return $this->message;\r
@@ -82,7 +84,7 @@ class Assert {
     $htmlExpected = htmlspecialchars($expected);\r
     $htmlActual = htmlspecialchars($actual);\r
     $str .= sprintf("<pre>%s\n--------\n%s</pre>",\r
-                   $htmlExpected, $htmlActual);\r
+        $htmlExpected, $htmlActual);\r
     $this->fail($str);\r
   }\r
 }\r
@@ -194,24 +196,24 @@ class TestSuite /* implements Test */ {
       // get matched below and then treated (incorrectly) as a test\r
       // method.  So don't name any TestCase subclasses as "Test..."!\r
       if (floor(phpversion()) >= 4) {\r
-       // PHP4 introspection, submitted by Dylan Kuhn\r
-       $names = get_class_methods($classname);\r
-       while (list($key, $method) = each($names)) {\r
-         if (preg_match('/^test/', $method) && $method != "testcase") {  \r
-           $this->addTest(new $classname($method));\r
-         }\r
-       }\r
+  // PHP4 introspection, submitted by Dylan Kuhn\r
+  $names = get_class_methods($classname);\r
+  while (list($key, $method) = each($names)) {\r
+    if (preg_match('/^test/', $method) && $method != "testcase") {\r
+      $this->addTest(new $classname($method));\r
+    }\r
+  }\r
       }\r
       else {\r
-       $dummy = new $classname("dummy");\r
-       $names = (array) $dummy;\r
-       while (list($key, $value) = each($names)) {\r
-         $type = gettype($value);\r
-         if ($type == "user function" && preg_match('/^test/', $key)\r
-         && $key != "testcase") {  \r
-           $this->addTest(new $classname($key));\r
-         }\r
-       }\r
+  $dummy = new $classname("dummy");\r
+  $names = (array) $dummy;\r
+  while (list($key, $value) = each($names)) {\r
+    $type = gettype($value);\r
+    if ($type == "user function" && preg_match('/^test/', $key)\r
+    && $key != "testcase") {\r
+      $this->addTest(new $classname($key));\r
+    }\r
+  }\r
       }\r
     }\r
   }\r
@@ -227,7 +229,7 @@ class TestSuite /* implements Test */ {
     reset($this->fTests);\r
     while (list($na, $test) = each($this->fTests)) {\r
       if ($testResult->shouldStop())\r
-       break;\r
+  break;\r
       $test->run(&$testResult);\r
     }\r
   }\r
@@ -275,7 +277,7 @@ class TestResult {
 \r
   function _endTest($test) /* protected */ {\r
       /* specialize this for end-of-test action, such as progress\r
-        reports  */\r
+   reports  */\r
   }\r
 \r
   function getFailures() {\r
@@ -324,7 +326,7 @@ class TextTestResult extends TestResult {
   function TextTestResult() {\r
     $this->TestResult();  // call superclass constructor\r
   }\r
-  \r
+\r
   function report() {\r
     /* report result of test run */\r
     $nRun = $this->countTests();\r
@@ -343,7 +345,7 @@ class TextTestResult extends TestResult {
       $exceptions = $failure->getExceptions();\r
       print("<ul>");\r
       while (list($na, $exception) = each($exceptions))\r
-       printf("<li>%s\n", $exception->getMessage());\r
+  printf("<li>%s\n", $exception->getMessage());\r
       print("</ul>");\r
     }\r
     print("</ol>\n");\r