コード例 #1
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);
     }
 }
コード例 #2
0
ファイル: FactoryTest.php プロジェクト: pombredanne/tuleap
 public function itDelegatesSaveToDao()
 {
     $id = 20;
     $rule = new Tracker_Rule_Date();
     $rule->setId($id);
     $rule->setSourceField($this->source_field);
     $rule->setComparator('>');
     $rule->setTargetField($this->target_field);
     stub($this->date_rule_dao)->save($id, $this->source_field_id, $this->target_field_id, '>')->once()->returns(true);
     $success = $this->date_rule_factory->save($rule);
     $this->assertTrue($success);
 }