Changeset 5582
- Timestamp:
- 10/18/07 20:10:32 (1 year ago)
- Files:
-
- branches/dwhittle/NOTES (modified) (1 diff)
- branches/dwhittle/lib/util/sfFinder.class.php (modified) (6 diffs)
- branches/dwhittle/lib/validator (copied) (copied from trunk/lib/validator)
- branches/dwhittle/lib/validator/sfValidator.class.php (copied) (copied from trunk/lib/validator/sfValidator.class.php)
- branches/dwhittle/lib/validator/sfValidatorAll.class.php (copied) (copied from trunk/lib/validator/sfValidatorAll.class.php)
- branches/dwhittle/lib/validator/sfValidatorAny.class.php (copied) (copied from trunk/lib/validator/sfValidatorAny.class.php)
- branches/dwhittle/lib/validator/sfValidatorBoolean.class.php (copied) (copied from trunk/lib/validator/sfValidatorBoolean.class.php)
- branches/dwhittle/lib/validator/sfValidatorCallback.class.php (copied) (copied from trunk/lib/validator/sfValidatorCallback.class.php)
- branches/dwhittle/lib/validator/sfValidatorChoice.class.php (copied) (copied from trunk/lib/validator/sfValidatorChoice.class.php)
- branches/dwhittle/lib/validator/sfValidatorChoiceMany.class.php (copied) (copied from trunk/lib/validator/sfValidatorChoiceMany.class.php)
- branches/dwhittle/lib/validator/sfValidatorDate.class.php (copied) (copied from trunk/lib/validator/sfValidatorDate.class.php)
- branches/dwhittle/lib/validator/sfValidatorDateTime.class.php (copied) (copied from trunk/lib/validator/sfValidatorDateTime.class.php)
- branches/dwhittle/lib/validator/sfValidatorEmail.class.php (copied) (copied from trunk/lib/validator/sfValidatorEmail.class.php)
- branches/dwhittle/lib/validator/sfValidatorError.class.php (copied) (copied from trunk/lib/validator/sfValidatorError.class.php)
- branches/dwhittle/lib/validator/sfValidatorErrorSchema.class.php (copied) (copied from trunk/lib/validator/sfValidatorErrorSchema.class.php)
- branches/dwhittle/lib/validator/sfValidatorInteger.class.php (copied) (copied from trunk/lib/validator/sfValidatorInteger.class.php)
- branches/dwhittle/lib/validator/sfValidatorNumber.class.php (copied) (copied from trunk/lib/validator/sfValidatorNumber.class.php)
- branches/dwhittle/lib/validator/sfValidatorPass.class.php (copied) (copied from trunk/lib/validator/sfValidatorPass.class.php)
- branches/dwhittle/lib/validator/sfValidatorRegex.class.php (copied) (copied from trunk/lib/validator/sfValidatorRegex.class.php)
- branches/dwhittle/lib/validator/sfValidatorSchema.class.php (copied) (copied from trunk/lib/validator/sfValidatorSchema.class.php)
- branches/dwhittle/lib/validator/sfValidatorSchemaCompare.class.php (copied) (copied from trunk/lib/validator/sfValidatorSchemaCompare.class.php)
- branches/dwhittle/lib/validator/sfValidatorSchemaForEach.class.php (copied) (copied from trunk/lib/validator/sfValidatorSchemaForEach.class.php)
- branches/dwhittle/lib/validator/sfValidatorString.class.php (copied) (copied from trunk/lib/validator/sfValidatorString.class.php)
- branches/dwhittle/lib/validator/sfValidatorUrl.class.php (copied) (copied from trunk/lib/validator/sfValidatorUrl.class.php)
- branches/dwhittle/test/bin/coverage.php (modified) (2 diffs)
- branches/dwhittle/test/unit/validator (copied) (copied from trunk/test/unit/validator)
- branches/dwhittle/test/unit/validator/sfValidatorAllTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorAllTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorAnyTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorAnyTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorBooleanTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorBooleanTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorCallbackTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorCallbackTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorChoiceManyTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorChoiceManyTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorChoiceTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorChoiceTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorDateTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorDateTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorDateTimeTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorDateTimeTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorEmailTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorEmailTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorErrorSchemaTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorErrorSchemaTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorErrorTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorErrorTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorIntegerTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorIntegerTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorNumberTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorNumberTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorPassTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorPassTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorRegexTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorRegexTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorSchemaCompareTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorSchemaCompareTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorSchemaForEachTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorSchemaForEachTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorSchemaTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorSchemaTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorStringTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorStringTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorTest.php)
- branches/dwhittle/test/unit/validator/sfValidatorUrlTest.php (copied) (copied from trunk/test/unit/validator/sfValidatorUrlTest.php)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/NOTES
r5262 r5582 60 60 * panels/dialogs/modals 61 61 * widgets (datatable) 62 * integrated debugger/logging 63 * rich admin (ajax filter updates, sortable, inline edit, etc..) branches/dwhittle/lib/util/sfFinder.class.php
r5125 r5582 48 48 protected $relative = false; 49 49 protected $follow_link = false; 50 protected $sort = false; 50 51 51 52 /** … … 247 248 248 249 return $this->discard($ignores)->prune($ignores); 250 } 251 252 /** 253 * Returns files and directories ordered by name 254 * 255 * @return object current sfFinder object 256 */ 257 public function sort_by_name() 258 { 259 $this->sort = 'name'; 260 261 return $this; 262 } 263 264 /** 265 * Returns files and directories ordered by type (directories before files), then by name 266 * 267 * @return object current sfFinder object 268 */ 269 public function sort_by_type() 270 { 271 $this->sort = 'type'; 272 273 return $this; 249 274 } 250 275 … … 352 377 } 353 378 379 if ($this->sort == 'name') 380 { 381 sort($files); 382 } 383 354 384 return array_unique($files); 355 385 } … … 368 398 369 399 $files = array(); 370 400 $temp_files = array(); 401 $temp_folders = array(); 371 402 if (is_dir($dir)) 372 403 { … … 383 414 384 415 if (is_dir($current_entry)) 416 { 417 if ($this->sort == 'type') 418 { 419 $temp_folders[$entryname] = $current_entry; 420 } 421 else 422 { 423 if (($this->type == 'directory' || $this->type == 'any') && ($depth >= $this->mindepth) && !$this->is_discarded($dir, $entryname) && $this->match_names($dir, $entryname) && $this->exec_ok($dir, $entryname)) 424 { 425 $files[] = realpath($current_entry); 426 } 427 428 if (!$this->is_pruned($dir, $entryname)) 429 { 430 $files = array_merge($files, $this->search_in($current_entry, $depth + 1)); 431 } 432 } 433 } 434 else 435 { 436 if (($this->type != 'directory' || $this->type == 'any') && ($depth >= $this->mindepth) && !$this->is_discarded($dir, $entryname) && $this->match_names($dir, $entryname) && $this->size_ok($dir, $entryname) && $this->exec_ok($dir, $entryname)) 437 { 438 if ($this->sort == 'type') 439 { 440 $temp_files[] = realpath($current_entry); 441 } 442 else 443 { 444 $files[] = realpath($current_entry); 445 } 446 } 447 } 448 } 449 450 if ($this->sort == 'type') 451 { 452 ksort($temp_folders); 453 foreach($temp_folders as $entryname => $current_entry) 385 454 { 386 455 if (($this->type == 'directory' || $this->type == 'any') && ($depth >= $this->mindepth) && !$this->is_discarded($dir, $entryname) && $this->match_names($dir, $entryname) && $this->exec_ok($dir, $entryname)) … … 394 463 } 395 464 } 396 else 397 { 398 if (($this->type != 'directory' || $this->type == 'any') && ($depth >= $this->mindepth) && !$this->is_discarded($dir, $entryname) && $this->match_names($dir, $entryname) && $this->size_ok($dir, $entryname) && $this->exec_ok($dir, $entryname)) 399 { 400 $files[] = realpath($current_entry); 401 } 402 } 403 } 465 466 sort($temp_files); 467 $files = array_merge($files, $temp_files); 468 } 469 404 470 closedir($current_dir); 405 471 } branches/dwhittle/test/bin/coverage.php
r4855 r5582 17 17 // unit tests 18 18 $h->register_glob($h->base_dir.'/unit/*/*Test.php'); 19 $h->register_glob($h->base_dir.'/unit/*/*/*Test.php'); 20 $h->register_glob($h->base_dir.'/../lib/plugins/*/unit/*Test.php'); 21 $h->register_glob($h->base_dir.'/../lib/plugins/*/unit/*/*Test.php'); 19 22 20 23 // functional tests 21 24 $h->register_glob($h->base_dir.'/functional/*Test.php'); 22 25 $h->register_glob($h->base_dir.'/functional/*/*Test.php'); 26 $h->register_glob($h->base_dir.'/../lib/plugins/*/functional/*Test.php'); 23 27 24 28 $c = new lime_coverage($h); … … 27 31 $c->base_dir = realpath(dirname(__FILE__).'/../../lib'); 28 32 29 $finder = sfFinder::type('file')->name('*.php')->prune('vendor') ;33 $finder = sfFinder::type('file')->name('*.php')->prune('vendor')->prune('test')->prune('data'); 30 34 $c->register($finder->in($c->base_dir)); 31 35 $c->run();