public function testAnyNonSmokerIsGreen() { $questionnaire = new Questionnaire(new Person()); $smoking = $questionnaire->getSmoking(); $smoking->setDoYouSmoke("no i've quit")->setCompletedDate(new \DateTime()); $questionnaire->setSmoking($smoking); $result = $this->instance->calculateScore($questionnaire); $this->assertEquals(SmokingScore::RAG_GREEN, $result['rag']); $this->assertEquals(SmokingScore::SCORE_GREEN, $result['value']); }
/** * @JMS\VirtualProperty * @JMS\SerializedName("rag_score") * @JMS\Groups({"results"}) * @return array */ public function getRagScore() { $scoring = new SmokingScore(); return $scoring->calculateScore($this->questionnaire); }