/**
  * @dataProvider provideWeatherFunction
  */
 public function testWeatherValue(CWeatherFunction $wf, $index, $weather, $localized, $condition)
 {
     $wv = new WeatherValue($index, $weather, $wf);
     $this->assertEquals($index, $wv->getIndex());
     $this->assertEquals($weather, $wv->getWeather(), '', 0.001);
     $this->assertEquals($localized, $wv->getLocalizedName());
     $this->assertEquals($condition, $wv->getWeatherDepositCondition());
 }
 public function defaultWeatherSetup()
 {
     //grab the weather values from the systemref table
     $q = Doctrine_Query::create()->select('s.name')->from('SystemRef s')->where("s.refType = 'weather'");
     $q->execute();
     $result = $q->execute(array(), Doctrine::HYDRATE_ARRAY);
     //insert values into the activity table
     foreach ($result as $key => $value) {
         //return $key."-".$value['name'];
         //insert into activitiy value table
         $weather = new WeatherValue();
         $weather->orgID = 16;
         $weather->weatherName = $value['name'];
         $weather->isActive = 1;
         $weather->rTime = date("d/m/y : H:i:s", time());
         $weather->rUser = $this->getUserID();
         $weather->save();
     }
 }
 public function weather()
 {
     //grab the weather values from the systemref table
     $q = Doctrine_Query::create()->select('s.name')->from('SystemRef s')->where("s.refType = 'weather'");
     $q->execute();
     $result = $q->execute(array(), Doctrine::HYDRATE_ARRAY);
     //Check for existing record
     $q2 = Doctrine_Query::create()->select('w.orgID')->from('WeatherValue w')->where("w.orgID = ?", $this->getOrgID());
     $q2->execute();
     if ($result2 = $q2->execute(array(), Doctrine::HYDRATE_ARRAY)) {
     } else {
         //insert values into the activity table
         foreach ($result as $key => $value) {
             //return $key."-".$value['name'];
             //insert into activitiy value table
             $weather = new WeatherValue();
             $weather->orgID = $this->getOrgID();
             $weather->weatherName = $value['name'];
             $weather->isActive = 1;
             $weather->rTime = $this->getDateFormat();
             $weather->rUser = $this->getUserID();
             $weather->save();
         }
     }
 }