Changeset 2274

Show
Ignore:
Timestamp:
03/10/2008 11:11:28 AM (7 months ago)
Author:
Geert
Message:

Test classes without test methods will now also be noted in the report.

Location:
trunk/modules/unit_test
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/unit_test/i18n/en_US/unit_test.php

    r2273 r2274  
    77        'test_class_not_found' => 'No test class by the name of %s found in %s.', 
    88        'test_class_extends'   => '%s must extend Unit_Test_Case.', 
     9        'no_tests_found'       => 'No tests found', 
    910        'passed'               => 'Passed', 
    1011        'failed'               => 'Failed', 
  • trunk/modules/unit_test/libraries/Unit_Test.php

    r2273 r2274  
    6060                                if ( ! class_exists($class, FALSE)) 
    6161                                        throw new Kohana_Exception('unit_test.test_class_not_found', $class, $path); 
    62  
     62$this->results[$class] = array(); 
    6363                                // Reverse-engineer Test class 
    6464                                $reflector = new ReflectionClass($class); 
  • trunk/modules/unit_test/views/kohana_unit_test.php

    r2267 r2274  
    8181 
    8282foreach ($results as $class => $methods): 
     83text::alternate(); 
    8384 
    8485?> 
     
    8990                </tr> 
    9091 
    91                 <?php 
     92                <?php if (empty($methods)): ?> 
    9293 
    93                 text::alternate(); 
    94                 foreach ($methods as $method => $result): 
    95  
    96                 ?> 
    97  
    98                         <tr class="<?php echo text::alternate('', 'k-altrow') ?>"> 
    99                                 <td class="k-name"><?php echo $method ?></td> 
    100  
    101                                 <?php if ($result === TRUE): ?> 
    102  
    103                                         <td class="k-passed"><strong><?php echo Kohana::lang('unit_test.passed') ?></strong></td> 
    104  
    105                                 <?php else: /* $result == Kohana_Unit_Test_Exception */ ?> 
    106  
    107                                         <td class="k-failed"> 
    108                                                 <strong><?php echo Kohana::lang('unit_test.failed') ?></strong> 
    109                                                 <pre><?php echo html::specialchars($result->message) ?></pre> 
    110                                                 <?php echo html::specialchars($result->file) ?> (<?php echo Kohana::lang('unit_test.line') ?>&nbsp;<?php echo $result->line ?>) 
    111  
    112                                                 <?php if ($result->debug !== NULL): ?> 
    113                                                         <pre class="k-debug" title="Debug info"><?php echo '(', gettype($result->debug), ') ', html::specialchars(var_export($result->debug, TRUE)) ?></pre> 
    114                                                 <?php endif ?> 
    115  
    116                                         </td> 
    117  
    118                                 <?php endif ?> 
    119  
     94                        <tr> 
     95                                <td colspan="2"><?php echo Kohana::lang('unit_test.no_tests_found') ?></td> 
    12096                        </tr> 
    12197 
    122                 <?php endforeach ?> 
     98                <?php else: 
     99 
     100                        foreach ($methods as $method => $result): 
     101 
     102                        ?> 
     103 
     104                                <tr class="<?php echo text::alternate('', 'k-altrow') ?>"> 
     105                                        <td class="k-name"><?php echo $method ?></td> 
     106 
     107                                        <?php if ($result === TRUE): ?> 
     108 
     109                                                <td class="k-passed"><strong><?php echo Kohana::lang('unit_test.passed') ?></strong></td> 
     110 
     111                                        <?php else: /* $result == Kohana_Unit_Test_Exception */ ?> 
     112 
     113                                                <td class="k-failed"> 
     114                                                        <strong><?php echo Kohana::lang('unit_test.failed') ?></strong> 
     115                                                        <pre><?php echo html::specialchars($result->message) ?></pre> 
     116                                                        <?php echo html::specialchars($result->file) ?> (<?php echo Kohana::lang('unit_test.line') ?>&nbsp;<?php echo $result->line ?>) 
     117 
     118                                                        <?php if ($result->debug !== NULL): ?> 
     119                                                                <pre class="k-debug" title="Debug info"><?php echo '(', gettype($result->debug), ') ', html::specialchars(var_export($result->debug, TRUE)) ?></pre> 
     120                                                        <?php endif ?> 
     121 
     122                                                </td> 
     123 
     124                                        <?php endif ?> 
     125 
     126                                </tr> 
     127 
     128                        <?php endforeach ?> 
     129 
     130                <?php endif ?> 
    123131 
    124132        </table>