Esempio n. 1
0
 public function testSearchByIdReturnsANewObjectIfOneEntryIsFoundByTheDao()
 {
     $data = array('id' => 20, 'comparator' => Tracker_Rule_Date::COMPARATOR_LESS_THAN_OR_EQUALS, 'source_field_id' => $this->source_field_id, 'target_field_id' => $this->target_field_id, 'tracker_id' => $this->tracker_id);
     stub($this->date_rule_dao)->searchById($this->tracker_id, 20)->returnsDar($data);
     stub($this->date_rule_dao)->searchById()->returnsEmptyDar();
     $date_rule = $this->date_rule_factory->getRule($this->tracker, 20);
     $this->assertNotNull($date_rule);
 }
Esempio n. 2
0
 private function updateARule($rule_id, array $new_values)
 {
     $rule = $this->rule_date_factory->getRule($this->tracker, (int) $rule_id);
     list($source_field, $target_field, $comparator) = $this->getFieldsAndComparatorFromRequestParameter($new_values);
     if ($this->shouldUpdateTheRule($rule, $source_field, $target_field, $comparator)) {
         $rule->setSourceField($source_field);
         $rule->setTargetField($target_field);
         $rule->setComparator($comparator);
         return $this->rule_date_factory->save($rule);
     }
 }