/** * Download a workout from a TCX. * * @param integer $idWorkout The ID of the workout to download. * @return Workout */ public function downloadWorkout($idWorkout) { $this->logger->debug('Downloading TCX for workout "' . $idWorkout . '"'); $loader = new TCX(); $polarWorkoutTCX = $this->getPolarAPI()->fetchWorkoutTCX($idWorkout); return $loader->fromString($polarWorkoutTCX); }
/** * Test loading a workout from a string with multiple activities. */ public function testFromStringMultiActivity() { $expected = new Workout(); $expected->addTrack(new Track(array($this->getTrackPoint('53.551075', '9.993672', '2014-05-30T17:12:58+00:00', 11, 0, 78), $this->getTrackPoint('53.550085', '9.992682', '2014-05-30T17:12:59+00:00', 10, 128, 88)), SportMapperInterface::RUNNING)); $expected->addTrack(new Track(array($this->getTrackPoint('53.549075', '9.991672', '2014-05-30T17:13:00+00:00', 9, null, 98), $this->getTrackPoint('53.548085', '9.990682', '2014-05-30T17:13:01+00:00', 8, 258, 108)), SportMapperInterface::SWIMMING)); $tcx = new TCX(); $actual = $tcx->fromString(file_get_contents(__DIR__ . '/Fixtures/testFromStringMultiActivity.tcx')); $this->assertEquals($expected, $actual); }