Esempio n. 1
0
 public function testForVDOT20()
 {
     $this->object->setVDOT(20);
     $this->object->setDaysToRecognizeForLongjogs(7);
     $this->object->setDaysToRecognizeForWeekKilometer(7);
     $this->object->setMinimalDaysToRecognizeForWeekKilometer(7);
     $this->object->setMinimalDistanceForLongjogs(10);
     $this->object->setPercentageForLongjogs(0.33);
     $this->object->setPercentageForWeekKilometer(0.67);
     DB::getInstance()->insert('training', array('sportid', 'time', 'distance'), array(Configuration::General()->runningSport(), time() - 1 * DAY_IN_S, 15));
     DB::getInstance()->insert('training', array('sportid', 'time', 'distance'), array(Configuration::General()->runningSport(), time() - 3 * DAY_IN_S, 15));
     DB::getInstance()->insert('training', array('sportid', 'time', 'distance'), array(Configuration::General()->runningSport(), time() - 8 * DAY_IN_S, 42));
     $Results = $this->object->asArray();
     $this->assertEquals(30, $Results['weekkm-result']);
     $this->assertEquals(0.82, $Results['longjog-result'], '', 0.01);
     $this->assertEquals(1.0, $Results['weekkm-percentage'], '', 0.01);
     $this->assertEquals(0.82, $Results['longjog-percentage'], '', 0.01);
     $this->assertEquals(94, $Results['percentage'], '', 0.01);
     $this->assertEquals(94, $this->object->value());
     $this->assertEquals('94 %', $this->object->valueInPercent());
     $this->object->setPercentageForLongjogs(1);
     $this->assertEquals(82, $this->object->value());
     $this->object->setDaysToRecognizeForLongjogs(14);
     $this->assertEquals(555, $this->object->value());
     // Attention: depens on START_TIME
     $this->object->setMinimalDaysToRecognizeForWeekKilometer(70);
     $this->object->setDaysToRecognizeForWeekKilometer(70);
     $this->object->setPercentageForLongjogs(0.01);
     $this->assertEquals(29, $this->object->value());
 }