當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Questionnaire::setDrinking方法代碼示例

本文整理匯總了PHP中TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire::setDrinking方法的典型用法代碼示例。如果您正苦於以下問題:PHP Questionnaire::setDrinking方法的具體用法?PHP Questionnaire::setDrinking怎麽用?PHP Questionnaire::setDrinking使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire的用法示例。


在下文中一共展示了Questionnaire::setDrinking方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetSetDrinking

 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());
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:QuestionnaireTest.php

示例2: testIGetAmberIfIDrinkUnder6DaysAWeekWithABingeAndIAmMale

 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());
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:12,代碼來源:DrinkingNarrativeBuilderTest.php

示例3: testIGetRedIfIDrinkOverUpperRiskLimitsAndIAmMale

 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']);
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:12,代碼來源:DrinkingScoreTest.php

示例4: testIGetARedRagWhenISmoke

 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));
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:18,代碼來源:QuestionnaireScoreTest.php


注:本文中的TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire::setDrinking方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。