public function testGetSetDrinking()
 {
     $expected = new Drinking($this->instance);
     $this->assertNotEmpty($this->instance->getDrinking());
     $this->assertTrue($this->instance->setDrinking($expected) instanceof Questionnaire);
     $this->assertEquals($expected, $this->instance->getDrinking());
 }
 public function testIGetAmberIfIDrinkUnder6DaysAWeekWithABingeAndIAmMale()
 {
     $person = new Person();
     $person->setGender(Person::GENDER_MALE);
     $questionnaire = new Questionnaire($person);
     $questionnaire->getAboutYou()->getFeelings()->setFatigue(40);
     $drinking = $questionnaire->getDrinking();
     $drinking->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('wed, thurs, sat')->setWeekendDrinks((new Drinks())->setBeerCiderBottleAmount(3)->setSpiritsAmount(3))->setWeekdayDrinks((new Drinks())->setBeerCiderBottleAmount(1))->setCompletedDate(new \DateTime());
     $questionnaire->setDrinking($drinking);
     $expected = array('drinking' => array('drinking_amber_low_fatigue_lte_14_units_has_binge'));
     $this->assertEquals($expected, $this->instance->buildNarrative($questionnaire)->getMessages());
 }
 public function testIGetRedIfIDrinkOverUpperRiskLimitsAndIAmMale()
 {
     $person = new Person();
     $person->setGender(Person::GENDER_MALE);
     $questionnaire = new Questionnaire($person);
     $drinking = $questionnaire->getDrinking();
     $drinking->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('mon, tues, wed, thurs, fri, sat')->setWeekendDrinks((new Drinks())->setBeerCiderPintAmount(4))->setWeekdayDrinks((new Drinks())->setBeerCiderPintAmount(4))->setCompletedDate(new \DateTime());
     $questionnaire->setDrinking($drinking);
     $rag = $this->instance->calculateScore($questionnaire);
     $this->assertEquals(DrinkingScore::RAG_RED, $rag['rag']);
     $this->assertEquals(DrinkingScore::SCORE_RED, $rag['value']);
 }
 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));
 }