public function testGetSetMoving()
 {
     $expected = new Moving($this->instance);
     $this->assertNotEmpty($this->instance->getMoving());
     $this->assertTrue($this->instance->setMoving($expected) instanceof Questionnaire);
     $this->assertEquals($expected, $this->instance->getMoving());
 }
 public function testIHave150MinutesAnd3OrMoreDaysIAmAerobicGreen()
 {
     $aerobic = array('mon' => 50, 'tue' => 50, 'wed' => 50);
     $questionnaire = new Questionnaire(new Person());
     $moving = $questionnaire->getMoving();
     $moving->setAerobicActivityDays($aerobic)->setCompletedDate(new \DateTime());
     $questionnaire->setMoving($moving);
     $this->assertTrue(AerobicIsGreenSpecification::isSatisfiedBy($questionnaire));
 }
 public function testIHaveLessThan60MinutesAndLessThanThreeDaysIAmAerobicRed()
 {
     $aerobic = array('mon' => 15, 'tue' => 15);
     $questionnaire = new Questionnaire(new Person());
     $moving = $questionnaire->getMoving();
     $moving->setAerobicActivityDays($aerobic)->setCompletedDate(new \DateTime());
     $questionnaire->setMoving($moving);
     $this->assertTrue(AerobicIsRedSpecification::isSatisfiedBy($questionnaire));
 }
 public function testIHave60OrMoreMinutesAndLessThanTwoDaysIAmAerobicAmber()
 {
     $aerobic = array('mon' => 50, 'wed' => 40);
     $questionnaire = new Questionnaire(new Person());
     $moving = $questionnaire->getMoving();
     $moving->setAerobicActivityDays($aerobic)->setCompletedDate(new \DateTime());
     $questionnaire->setMoving($moving);
     $this->assertFalse(AerobicIsGreenSpecification::isSatisfiedBy($questionnaire));
     $this->assertFalse(AerobicIsRedSpecification::isSatisfiedBy($questionnaire));
 }
 public function testIGetARedRagWhenISmoke()
 {
     $person = new Person();
     $person->setGender('female');
     $questionnaire = new Questionnaire($person);
     $drinking = $questionnaire->getDrinking();
     $drinking->setWeekendDrinks(new Drinks())->setWeekdayDrinks(new Drinks())->setCompletedDate(new \DateTime());
     $questionnaire->setDrinking($drinking);
     $questionnaire->getSmoking()->setCompletedDate(new \DateTime());
     $moving = $questionnaire->getMoving();
     $movingArray = array('mon' => 50, 'tue' => 50, 'wed' => 50);
     $moving->setAerobicActivityDays($movingArray)->setStrengtheningActivityDays($movingArray)->setCompletedDate(new \DateTime());
     $questionnaire->setMoving($moving);
     $questionnaire->getEating()->setCompletedDate(new \DateTime());
     $questionnaire->getSmoking()->setDoYouSmoke('yes')->setCompletedDate(new \DateTime());
     $expected = array('value' => QuestionnaireScore::SCORE_RED, 'rag' => QuestionnaireScore::RAG_RED, 'normalized_score' => QuestionnaireScore::RED_CUTOFF);
     $this->assertEquals($expected, $this->instance->calculateScore($questionnaire));
 }
 /**
  * Cutoff is 3 days of 10+ minutes with a min total of 150 minutes for aerobic
  * 2 days of 30+ minutes for strength
  */
 public function testIGetGreenWithExactCutoffs()
 {
     $aerobic = array('mon' => 50, 'tue' => 50, 'wed' => 50);
     $strength = array('mon' => 30, 'tue' => 30);
     $questionnaire = new Questionnaire(new Person());
     $moving = $questionnaire->getMoving();
     $moving->setAerobicActivityDays($aerobic)->setStrengtheningActivityDays($strength)->setCompletedDate(new \DateTime());
     $questionnaire->setMoving($moving);
     $result = $this->instance->calculateScore($questionnaire);
     $this->assertEquals(MovingScore::SCORE_GREEN, $result['value']);
     $this->assertEquals(MovingScore::RAG_GREEN, $result['rag']);
 }