/** * @param Questionnaire $questionnaire */ protected function buildAmberAboutYouNarrative(Questionnaire $questionnaire) { if (AboutYouFeelingsAreAllZeroSpecification::isSatisfiedBy($questionnaire)) { $this->buildOpeningNarrative(RagScore::RAG_AMBER . '_neutral'); } else { $this->buildOpeningNarrative(RagScore::RAG_AMBER . '_mixed'); } $this->buildHindrancesNarrative($questionnaire, RagScore::RAG_AMBER); $this->buildDependantsNarrative($questionnaire, RagScore::RAG_AMBER); $this->buildClosingNarrative(RagScore::RAG_AMBER); }
public function testAboutYouFeelingsAreAllZeroSpecificationReturnsFalse() { $questionnaire = new Questionnaire(new Person()); $questionnaire->getAboutYou()->getFeelings()->setMood(100)->setWeight(0); $this->assertFalse(AboutYouFeelingsAreAllZeroSpecification::isSatisfiedBy($questionnaire)); }
/** * @param Questionnaire $questionnaire */ protected function buildOverviewParagraph(Questionnaire $questionnaire) { switch (true) { case AboutYouIsGreenSpecification::isSatisfiedBy($questionnaire): $rag = RagScore::RAG_GREEN; break; case AboutYouIsRedSpecification::isSatisfiedBy($questionnaire): $rag = RagScore::RAG_RED; break; case AboutYouFeelingsAreAllZeroSpecification::isSatisfiedBy($questionnaire): $rag = RagScore::RAG_AMBER . '_neutral'; break; default: $rag = RagScore::RAG_AMBER . '_mixed'; } $overview = sprintf("score_about_you_%s_total_%s", $rag, $questionnaire->getRagScore()['rag']); $this->narrative->addMessages(self::SECTION_NAME, array('overview' => $overview)); }