Development

Changeset 5582

You must first sign up to be able to contribute.

Changeset 5582

Show
Ignore:
Timestamp:
10/18/07 20:10:32 (1 year ago)
Author:
dwhittle
Message:

dwhittle: merged changes frum trunk: new validation system, finder sort option, lime code coverage

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dwhittle/NOTES

    r5262 r5582  
    6060  * panels/dialogs/modals 
    6161  * 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  
    4848  protected $relative    = false; 
    4949  protected $follow_link = false; 
     50  protected $sort        = false; 
    5051 
    5152  /** 
     
    247248 
    248249    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; 
    249274  } 
    250275 
     
    352377    } 
    353378 
     379    if ($this->sort == 'name') 
     380    { 
     381      sort($files); 
     382    } 
     383 
    354384    return array_unique($files); 
    355385  } 
     
    368398 
    369399    $files = array(); 
    370  
     400    $temp_files = array(); 
     401    $temp_folders = array(); 
    371402    if (is_dir($dir)) 
    372403    { 
     
    383414 
    384415        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) 
    385454        { 
    386455          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)) 
     
    394463          } 
    395464        } 
    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 
    404470      closedir($current_dir); 
    405471    } 
  • branches/dwhittle/test/bin/coverage.php

    r4855 r5582  
    1717// unit tests 
    1818$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'); 
    1922 
    2023// functional tests 
    2124$h->register_glob($h->base_dir.'/functional/*Test.php'); 
    2225$h->register_glob($h->base_dir.'/functional/*/*Test.php'); 
     26$h->register_glob($h->base_dir.'/../lib/plugins/*/functional/*Test.php'); 
    2327 
    2428$c = new lime_coverage($h); 
     
    2731$c->base_dir = realpath(dirname(__FILE__).'/../../lib'); 
    2832 
    29 $finder = sfFinder::type('file')->name('*.php')->prune('vendor')
     33$finder = sfFinder::type('file')->name('*.php')->prune('vendor')->prune('test')->prune('data')
    3034$c->register($finder->in($c->base_dir)); 
    3135$c->run();