public function testICanGetANarrativeWithMaxFeeling() { $questionnaire = new Questionnaire(new Person()); $questionnaire->getAboutYou()->getFeelings()->setEnergy(100)->setMood(100)->setWeight(100)->setFatigue(100)->setFitness(100)->setStress(100); $questionnaire->getSmoking()->setDoYouSmoke('sometimes')->setCompletedDate(new \DateTime()); $expected = array('smoking_red_sometimes'); $results = $this->instance->buildNarrative($questionnaire)->getMessages()['smoking']; foreach ($expected as $value) { $this->assertTrue(in_array($value, $results)); } }
public function testMyNarrativeIsRed() { $expected = array('smoking' => array("smoking_red", "smoking_red_high_weight"), 'drinking' => array("drinking_green_never"), 'moving' => array("moving_green"), 'eating' => array("eating_green"), 'results' => array('headline' => "score_headline_3", 'intro' => "score_headline_intro", 'overview' => "score_about_you_green_total_red", 'behaviours_headline' => "score_behaviour_results_red_headline", 'behaviours_body' => "score_behaviour_results_red_body", 'smoking' => "behaviours_smoking_red", 'drinking' => "behaviours_drinking_green_never", 'moving' => "behaviours_moving_green_days_gte5", 'eating' => "behaviours_eating_green")); $result = $this->builder->buildNarrative($this->questionnaire); $this->assertEquals($expected, $result->getMessages()); }
/** * @JMS\VirtualProperty * @JMS\SerializedName("narrative") * @JMS\Groups({"narrative", "results"}) * @return Narrative */ public function getNarrative() { $builder = new NarrativeBuilder(); $narrative = $builder->buildNarrative($this); $narrative->addSubstitution('{{NAME}}', $this->getPerson()->getFirstName()); return $narrative; }
public function testMyNarrativeIsGreen() { $expected = array('smoking' => array("smoking_green_never"), 'drinking' => array("drinking_green_2_to_4_monthly_with_binge"), 'moving' => array("moving_amber_aerobic_amber_duration_strength_green", "moving_amber_low_weight"), 'eating' => array("eating_green", "eating_green_low_weight"), 'results' => array('headline' => "score_headline_8", 'intro' => "score_headline_intro", 'overview' => "score_about_you_green_total_green", 'behaviours_headline' => "score_behaviour_results_green_headline", 'behaviours_body' => "score_behaviour_results_green_body", 'smoking' => "behaviours_smoking_green", 'drinking' => "behaviours_drinking_green_2_to_4_monthly_with_binge", 'moving' => "behaviours_moving_aerobic_amber_duration_strength_green", 'eating' => "behaviours_eating_green")); $result = $this->builder->buildNarrative($this->questionnaire); $this->assertEquals($expected, $result->getMessages()); }
public function testMyNarrativeIsAmber() { $expected = array('smoking' => array("smoking_green_never"), 'drinking' => array("drinking_green_in_gender_limits"), 'moving' => array("moving_red", "moving_red_min_weight"), 'eating' => array("eating_green", "eating_green_min_weight"), 'results' => array('headline' => "score_headline_7", 'intro' => "score_headline_intro", 'overview' => "score_about_you_red_total_amber", 'behaviours_headline' => "score_behaviour_results_amber_headline", 'behaviours_body' => "score_behaviour_results_amber_body", 'smoking' => "behaviours_smoking_green", 'drinking' => "behaviours_drinking_green_in_gender_limits", 'moving' => "behaviours_moving_red_no_strength", 'eating' => "behaviours_eating_green")); $result = $this->builder->buildNarrative($this->questionnaire); $this->assertEquals($expected, $result->getMessages()); }
public function testMyNarrativeIsRed() { $expected = array('smoking' => array("smoking_red", "smoking_red_min_weight"), 'drinking' => array("drinking_red_min_weight_gt_5_days_female"), 'moving' => array("moving_red", "moving_red_min_weight"), 'eating' => array("eating_red", "eating_red_min_weight"), 'results' => array('headline' => "score_headline_1", 'intro' => "score_headline_intro", 'overview' => "score_about_you_amber_mixed_total_red", 'behaviours_headline' => "score_behaviour_results_red_headline", 'behaviours_body' => "score_behaviour_results_red_body", 'smoking' => "behaviours_smoking_red", 'drinking' => "behaviours_drinking_red_female", 'moving' => "behaviours_moving_red_no_strength", 'eating' => "behaviours_eating_snacks_red")); $result = $this->builder->buildNarrative($this->questionnaire); $this->assertEquals($expected, $result->getMessages()); }