Changeset 2273 for trunk/modules/unit_test/libraries/Unit_Test.php
- Timestamp:
- 03/10/2008 11:03:30 AM (10 months ago)
- Files:
-
- 1 modified
-
trunk/modules/unit_test/libraries/Unit_Test.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/unit_test/libraries/Unit_Test.php
r2272 r2273 23 23 public function __construct() 24 24 { 25 // Normalize all given test paths25 // Loop over each given test path 26 26 foreach (func_get_args() as $path) 27 27 { 28 $this->paths[] = str_replace('\\', '/', realpath($path)); 29 } 30 31 // Recursively iterate over all test paths 32 foreach ($this->paths as $test_path) 33 { 28 // Normalize all given test paths and store them 29 $this->paths[] = $test_path = str_replace('\\', '/', realpath((string) $path)); 30 31 // Validate test path 32 if ( ! is_dir($test_path)) 33 throw new Kohana_Exception('unit_test.invalid_test_path', $test_path); 34 35 // Recursively iterate over each file in the test path 34 36 foreach 35 37 ( … … 48 50 $class = substr($path, strrpos($path, '/') + 1, -(strlen(EXT))); 49 51 52 // Check for duplicate test class name 53 if (class_exists($class, FALSE)) 54 throw new Kohana_Exception('unit_test.duplicate_test_class', $class, $path); 55 50 56 // Include the test class 51 57 include_once $path; 52 58 53 // Validate the class name59 // Check whether the test class has been found and loaded 54 60 if ( ! class_exists($class, FALSE)) 55 continue;61 throw new Kohana_Exception('unit_test.test_class_not_found', $class, $path); 56 62 57 63 // Reverse-engineer Test class … … 60 66 // Test classes must extend Unit_Test_Case 61 67 if ( ! $reflector->isSubclassOf(new ReflectionClass('Unit_Test_Case'))) 62 break;68 throw new Kohana_Exception('unit_test.test_class_extends', $class); 63 69 64 70 // Loop through all the class methods
