Example #1
0
 /**
  * @param array $data
  * @return int
  */
 protected function insert(array $data)
 {
     $Inserter = new Inserter($this->PDO, new Object($data));
     $Inserter->setAccountID(0);
     $Inserter->insert();
     return $Inserter->insertedID();
 }
Example #2
0
 public function testPowerCalculation()
 {
     // TODO: Needs configuration setting
     if (Configuration::ActivityForm()->computePower()) {
         $ActivityIndoor = new Object(array(Object::DISTANCE => 10, Object::TIME_IN_SECONDS => 3000, Object::SPORTID => $this->IndoorID));
         $Trackdata = new Model\Trackdata\Object(array(Model\Trackdata\Object::TIME => array(1500, 3000), Model\Trackdata\Object::DISTANCE => array(5, 10)));
         $Inserter = new Inserter($this->PDO);
         $Inserter->setAccountID(0);
         $Inserter->setTrackdata($Trackdata);
         $Inserter->insert($ActivityIndoor);
         $this->assertEquals(0, $this->fetch($Inserter->insertedID())->power());
         $ActivityOutdoor = clone $ActivityIndoor;
         $ActivityOutdoor->set(Object::SPORTID, $this->OutdoorID);
         $Inserter->insert($ActivityOutdoor);
         $this->assertNotEquals(0, $this->fetch($Inserter->insertedID())->power());
         $this->assertNotEmpty($Trackdata->power());
     }
 }