Ejemplo n.º 1
0
 foreach (array("score", "total", "passed", "failed", "errors") as $key) {
     @($totals[$key] += $stats[$class][$key]);
 }
 if (empty($methods)) {
     printf("| %s%-96.96s%s |\n", magenta_start(), "NO TESTS FOUND", color_end());
 } else {
     foreach ($methods as $method => $result) {
         // Hide passed tests from report
         if ($result === true and $hide_passed === true) {
             continue;
         }
         if ($result === true) {
             printf("| %s%-85.85s%s | %sPASS%s     |\n", green_start(), $method, color_end(), green_start(), color_end());
         } else {
             if ($result instanceof Kohana_Unit_Test_Exception) {
                 printf("| %s%-85.85s%s | %sFAIL%s     |\n", red_start(), $method, color_end(), red_start(), color_end());
                 echo "  ", $result->getMessage(), "\n";
                 echo "  ", $result->getFile();
                 echo " ", "(line " . $result->getLine(), ")\n";
                 if ($result->getDebug() !== null) {
                     echo "  ", "(", gettype($result->getDebug()), ") ", var_export($result->getDebug(), true), "\n";
                 }
                 echo "\n";
             } else {
                 if ($result instanceof Exception) {
                     printf("| %s%-85.85s%s | %sERROR%s    |\n", magenta_start(), $method, color_end(), magenta_start(), color_end());
                     if ($result->getMessage()) {
                         echo "  ", $result->getMessage(), "\n";
                     }
                     if ($result instanceof ORM_Validation_Exception) {
                         echo "  Validation errors:\n";
Ejemplo n.º 2
0
 if (empty($methods)) {
   printf("| %s%-96.96s%s |\n", magenta_start(), "NO TESTS FOUND", color_end());
 } else {
   foreach ($methods as $method => $result) {
     // Hide passed tests from report
     if ($result === true AND $hide_passed === true) {
       continue;
     }
     if ($result === true) {
       printf("| %s%-85.85s%s | %sPASS%s     |\n",
              green_start(), $method, color_end(),
              green_start(), color_end());
     } else if ($result instanceof Kohana_Unit_Test_Exception) {
       printf("| %s%-85.85s%s | %sFAIL%s     |\n",
              red_start(), $method, color_end(),
              red_start(), color_end());
       echo "  ", $result->getMessage(), "\n";
       echo "  ", $result->getFile();
       echo " ", "(line " . $result->getLine(), ")\n";
       if ($result->getDebug() !== null) {
         echo "  ", "(", gettype($result->getDebug()), ") ",
           var_export($result->getDebug(), true), "\n";
       }
       echo "\n";
     } else if ($result instanceof Exception) {
       printf("| %s%-85.85s%s | %sERROR%s    |\n",
              magenta_start(), $method, color_end(),
              magenta_start(), color_end());
       if ($result->getMessage()) {
         echo "  ", $result->getMessage(), "\n";
       }