Changeset 2279
- Timestamp:
- 03/10/08 17:43:37 (6 months ago)
- Location:
- trunk/modules/unit_test
- Files:
-
- 2 added
- 1 modified
-
config (added)
-
config/unit_test.php (added)
-
libraries/Unit_Test.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/unit_test/libraries/Unit_Test.php
r2278 r2279 29 29 public function __construct() 30 30 { 31 // Merge possible default test path(s) from config with the rest 32 $paths = array_merge(func_get_args(), Config::item('unit_test.paths', FALSE, FALSE)); 33 34 // Normalize all test paths 35 foreach ($paths as $path) 36 { 37 $path = str_replace('\\', '/', realpath((string) $path)); 38 } 39 40 // Take out duplicate test paths after normalization 41 $this->paths = array_unique($paths); 42 31 43 // Loop over each given test path 32 foreach ( func_get_args()as $path)44 foreach ($this->paths as $path) 33 45 { 34 // Normalize all given test paths and store them35 $this->paths[] = $test_path = str_replace('\\', '/', realpath((string) $path));36 37 46 // Validate test path 38 if ( ! is_dir($ test_path))39 throw new Kohana_Exception('unit_test.invalid_test_path', $ test_path);47 if ( ! is_dir($path)) 48 throw new Kohana_Exception('unit_test.invalid_test_path', $path); 40 49 41 50 // Recursively iterate over each file in the test path 42 51 foreach 43 52 ( 44 new RecursiveIteratorIterator(new RecursiveDirectoryIterator($ test_path, RecursiveDirectoryIterator::KEY_AS_PATHNAME))53 new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_PATHNAME)) 45 54 as $path => $file 46 55 )
