- Timestamp:
- 05/27/10 12:53:10 (11 years ago)
- Location:
- trunk/server/www/app
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/www/app/models/testsuite.php
r350 r365 30 30 * Synchronise all testsuite files to the database 31 31 */ 32 public function synchronise() 33 { 34 $suites = $this->find('all'); 32 public function synchronise($id = 'all') 33 { 34 if ($id == 'all') { 35 $suites = $this->find('all'); 36 } else { 37 $suites = $this->find('all', array( 38 'conditions' => array('Testsuite.id' => $id), 39 )); 40 } 41 35 42 foreach ($suites as &$suite) { 36 43 $this->log(sprintf('Synchronising testsuite "%s"', $suite['Testsuite']['name']), LOG_DEBUG); -
trunk/server/www/app/vendors/shells/suites.php
r346 r365 21 21 class SuitesShell extends Shell 22 22 { 23 /** @var array The models to use */ 24 public $uses = array('Testsuite'); 25 23 26 /** 24 27 * Override startup() so no welcome message is printed … … 39 42 public function sync() 40 43 { 41 $ Testsuite = ClassRegistry::init('Testsuite');42 $ Testsuite->synchronise();44 $suite_id = $this->_getSuite(); 45 $this->Testsuite->synchronise($suite_id); 43 46 } 44 47 … … 48 51 public function addJobs() 49 52 { 50 $Testsuite = ClassRegistry::init('Testsuite'); 51 $Testsuite->addJobs(); 53 $this->Testsuite->addJobs(); 54 } 55 56 /** 57 * Ask for a test suite 58 */ 59 private function _getSuite() 60 { 61 $options = array(1 => 'All test suites'); 62 $suites = $this->Testsuite->find('list', array( 63 'order' => 'Testsuite.name ASC', 64 'recursive' => -1, 65 )); 66 67 foreach ($suites as $suite) { 68 $options[] = $suite; 69 } 70 71 $this->out('Please coose a test suite.'); 72 $this->hr(); 73 foreach ($options as $index => $option) { 74 $this->out(sprintf('[%d] %s', $index, $option)); 75 } 76 77 $suite_id = null; 78 while ($suite_id === null) { 79 $suiteNum = $this->in('Enter a test suite number, or q to quit', null, 'q'); 80 81 if (strtolower($suiteNum) === 'q') { 82 $this->out('Exit'); 83 $this->_stop(); 84 } 85 86 $suiteNum = intval($suiteNum) - 2; 87 if ($suiteNum >= count($suites)) { 88 $this->out('Invalid selection'); 89 continue; 90 } 91 92 if ($suiteNum == -1) { 93 $suite_id = false; 94 } else { 95 $suite_ids = array_keys($suites); 96 $suite_id = $suite_ids[$suiteNum]; 97 } 98 } 99 100 return $suite_id; 52 101 } 53 102
Note: See TracChangeset
for help on using the changeset viewer.