public function testDynamicSetting() { $HR = new HeartRate(150); $this->assertEquals(150, $HR->inBPM()); $HR->setBPM(120); $this->assertEquals(120, $HR->inBPM()); }
/** * Init data */ protected function initData() { $this->paceUnit = $this->Context->sport()->paceUnit(); $Zones = $this->computeZones(); $hrMax = Runalyze\Configuration::Data()->HRmax(); $Pace = new Pace(0, 1, $this->paceUnit); $HR = new HeartRate(0, Runalyze\Context::Athlete()); foreach ($Zones as $paceInSeconds => $Info) { if ($Info['time'] > parent::MINIMUM_TIME_IN_ZONE) { $Pace->setTime($paceInSeconds); $HR->setBPM($Info['time'] > 0 ? $Info['hr'] / $Info['time'] : 0); $this->Data[] = array('zone' => $paceInSeconds == 0 ? __('faster') : '> ' . $Pace->valueWithAppendix(), 'time' => $Info['time'], 'distance' => $Info['distance'], 'average' => $HR->asBPM() > 0 ? $HR->string() : '-'); } } }