Exemplo n.º 1
0
 /**
  * test reading min and max priority 
  */
 public function testPriority()
 {
     $this->assertEquals(1, $this->model->minPriority());
     $this->assertEquals(2, $this->model->maxPriority());
 }
 /**
  * reset priorities depending on the current
  * max and min priorities of all feeds
  *
  * @return array new settings
  */
 protected function resetPriorities()
 {
     // set min and max priority
     $feedModel = new application_models_feeds();
     $min = $feedModel->minPriority();
     $max = $feedModel->maxPriority();
     $newSettings = array('priorityStart' => $min, 'priorityEnd' => $max);
     // reset current priority if necessary
     if (Zend_Registry::get('session')->currentPriorityStart < $min) {
         $newSettings['currentPriorityStart'] = $min;
     }
     if (Zend_Registry::get('session')->currentPriorityEnd > $max) {
         $newSettings['currentPriorityEnd'] = $max;
     }
     if (Zend_Registry::get('session')->currentPriorityEnd < $min) {
         $newSettings['currentPriorityEnd'] = $min;
     }
     // save new settings
     $settings = new application_models_settings();
     $settings->set($newSettings);
     return $newSettings;
 }