/** * @param array $data * @param array $route * @param array $trackdata * @return int */ protected function insertActivity(array $data, array $route, array $trackdata) { $Inserter = new Inserter($this->PDO, new Object($data)); $Inserter->setRoute(new Route\Object($route)); $Inserter->setTrackdata(new Trackdata\Object($trackdata)); return $this->runInserter($Inserter); }
public function testWithCalculationsFromAdditionalObjects() { $Activity = new Object(array(Object::DISTANCE => 10, Object::TIME_IN_SECONDS => 3000, Object::HR_AVG => 150, Object::SPORTID => Configuration::General()->runningSport())); $Inserter = new Inserter($this->PDO); $Inserter->setAccountID(0); $Inserter->insert($Activity); $ObjectWithout = $this->fetch($Inserter->insertedID()); $Inserter->setTrackdata(new Model\Trackdata\Object(array(Model\Trackdata\Object::TIME => array(1500, 3000), Model\Trackdata\Object::HEARTRATE => array(125, 175)))); $Inserter->setRoute(new Model\Route\Object(array(Model\Route\Object::ELEVATION_UP => 500, Model\Route\Object::ELEVATION_DOWN => 100))); $Inserter->insert($Activity); $ObjectWith = $this->fetch($Inserter->insertedID()); $this->assertGreaterThan($ObjectWithout->vdotWithElevation(), $ObjectWith->vdotWithElevation()); $this->assertGreaterThan($ObjectWithout->jdIntensity(), $ObjectWith->jdIntensity()); $this->assertGreaterThan($ObjectWithout->trimp(), $ObjectWith->trimp()); }