本文整理汇总了PHP中TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire::getSmoking方法的典型用法代码示例。如果您正苦于以下问题:PHP Questionnaire::getSmoking方法的具体用法?PHP Questionnaire::getSmoking怎么用?PHP Questionnaire::getSmoking使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire
的用法示例。
在下文中一共展示了Questionnaire::getSmoking方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->builder = new NarrativeBuilder();
$person = new Person();
$person->setGender('male')->setAge('40')->setFirstName(uniqid('FN_'));
$this->questionnaire = new Questionnaire($person);
$this->questionnaire->getAboutYou()->setCompletedDate(new \DateTime());
$this->questionnaire->getAboutYou()->getFeelings()->setEnergy(100)->setFatigue(100)->setMood(100)->setFitness(100)->setStress(100)->setWeight(35)->setCompletedDate(new \DateTime());
$this->questionnaire->getEating()->setDrinksChoice('water')->setBreakfastChoice('other')->setCheeseChoice('other')->setProteinChoice('5')->setFruitAndVegChoice('5')->setPotatoesChoice('other')->setDailySnackChoice('')->setCompletedDate(new \DateTime());
$this->questionnaire->getSmoking()->setDoYouSmoke('no')->setCompletedDate(new \DateTime());
$this->questionnaire->getDrinking()->setDoYouDrink(Drinking::DRINK_TWO_TO_FOUR_TIMES_A_MONTH)->setBingingFrequency(Drinking::BINGE_L_T_MONTHLY)->setCompletedDate(new \DateTime());
$moving = array('mon' => 30, 'wed' => 30, 'fri' => 30, 'sun' => 30);
$this->questionnaire->getMoving()->setAerobicActivityDays($moving)->setStrengtheningActivityDays($moving)->setCompletedDate(new \DateTime());
}
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:14,代码来源:IGetAGreenNarrativeWithAScoreOfEightTest.php
示例2: setUp
public function setUp()
{
$this->builder = new NarrativeBuilder();
$person = new Person();
$person->setGender('male')->setAge('40')->setFirstName(uniqid('FN_'));
$this->questionnaire = new Questionnaire($person);
$this->questionnaire->getAboutYou()->setCompletedDate(new \DateTime());
$this->questionnaire->getAboutYou()->getFeelings()->setEnergy(100)->setFatigue(100)->setMood(100)->setFitness(100)->setStress(100)->setWeight(80)->setCompletedDate(new \DateTime());
$this->questionnaire->getEating()->setDrinksChoice('water')->setBreakfastChoice('other')->setCheeseChoice('other')->setProteinChoice('5')->setFruitAndVegChoice('5')->setPotatoesChoice('other')->setDailySnackChoice('')->setCompletedDate(new \DateTime());
$this->questionnaire->getSmoking()->setDoYouSmoke('yes')->setCompletedDate(new \DateTime());
$this->questionnaire->getDrinking()->setDoYouDrink(Drinking::DO_NOT_DRINK)->setWhichDaysDoYouDrink('mon, tue, wed, thur, fri, sat, sun')->setCompletedDate(new \DateTime());
$moving = array('mon' => 30, 'tue' => 30, 'wed' => 30, 'thur' => 30, 'fri' => 30, 'sat' => 30, 'sun' => 30);
$this->questionnaire->getMoving()->setAerobicActivityDays($moving)->setStrengtheningActivityDays($moving)->setCompletedDate(new \DateTime());
}
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:14,代码来源:IGetARedRagAndScoreOfThreeBecauseISmokeTest.php
示例3: generateScore
/**
* @param Questionnaire $questionnaire
* @return int
*/
protected function generateScore(Questionnaire $questionnaire)
{
$result = 0;
$result += $questionnaire->getDrinking()->getRagScore()['value'];
$result += $questionnaire->getMoving()->getRagScore()['value'];
$result += $questionnaire->getEating()->getRagScore()['value'];
$result += $questionnaire->getSmoking()->getRagScore()['value'];
if ($questionnaire->getSmoking()->getRagScore()['rag'] === RagScore::RAG_RED) {
if ($result > self::RED_CUTOFF) {
return self::RED_CUTOFF;
}
}
return $result;
}
示例4: setUp
public function setUp()
{
$this->builder = new NarrativeBuilder();
$person = new Person();
$person->setGender('male')->setAge('40')->setFirstName(uniqid('FN_'));
$this->questionnaire = new Questionnaire($person);
$this->questionnaire->getAboutYou()->setCompletedDate(new \DateTime());
$this->questionnaire->getAboutYou()->getFeelings()->setEnergy(30)->setFatigue(30)->setMood(30)->setFitness(30)->setStress(30)->setWeight(0)->setCompletedDate(new \DateTime());
$this->questionnaire->getEating()->setDrinksChoice('water')->setBreakfastChoice('other')->setCheeseChoice('other')->setProteinChoice('5')->setFruitAndVegChoice('5')->setPotatoesChoice('other')->setDailySnackChoice('')->setCompletedDate(new \DateTime());
$this->questionnaire->getSmoking()->setDoYouSmoke('no')->setCompletedDate(new \DateTime());
$drinks = new Drinks();
$drinks->setBeerCiderPintAmount(2);
$this->questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWeekdayDrinks($drinks)->setWeekendDrinks($drinks)->setWhichDaysDoYouDrink('mon, wed, fri, sun')->setCompletedDate(new \DateTime());
$this->questionnaire->getMoving()->setCompletedDate(new \DateTime());
}
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:15,代码来源:IGetAnAmberNarrativeWithAScoreOfSevenTest.php
示例5: setUp
public function setUp()
{
$this->builder = new NarrativeBuilder();
$person = new Person();
$person->setGender('female')->setAge('40')->setFirstName(uniqid('FN_'));
$this->questionnaire = new Questionnaire($person);
$this->questionnaire->getAboutYou()->setCompletedDate(new \DateTime());
$this->questionnaire->getAboutYou()->getFeelings()->setEnergy(100)->setFatigue(100)->setMood(100)->setFitness(100)->setStress(100)->setWeight(35)->setCompletedDate(new \DateTime());
$this->questionnaire->getEating()->setDrinksChoice('sugary drink')->setBreakfastChoice('sugary cereal')->setCheeseChoice('hard cheese')->setProteinChoice('ham')->setFruitAndVegChoice('0')->setPotatoesChoice('chips')->setDailySnackChoice('sweets, crisps, cake, biscuits')->setCompletedDate(new \DateTime());
$this->questionnaire->getSmoking()->setDoYouSmoke('no')->setCompletedDate(new \DateTime());
$drinks = (new Drinks())->setBeerCiderPintAmount(5)->setBeerCiderBottleAmount(5);
$this->questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('thur, fri, sat')->setWeekendDrinks($drinks)->setWeekdayDrinks($drinks)->setCompletedDate(new \DateTime());
$moving = array('mon' => 40, 'tue' => 40, 'wed' => 40, 'sun' => 40);
$this->questionnaire->getMoving()->setAerobicActivityDays($moving)->setStrengtheningActivityDays($moving)->setCompletedDate(new \DateTime());
}
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:15,代码来源:IGetAnAmberNarrativeWithAScoreOfFiveTest.php
示例6: setUp
public function setUp()
{
$this->builder = new NarrativeBuilder();
$person = new Person();
$person->setGender('female')->setAge('40')->setFirstName(uniqid('FN_'));
$this->questionnaire = new Questionnaire($person);
$this->questionnaire->getAboutYou()->setCompletedDate(new \DateTime());
$this->questionnaire->getAboutYou()->getFeelings()->setWeight(0)->setCompletedDate(new \DateTime());
$this->questionnaire->getEating()->setDrinksChoice('sugary drink')->setBreakfastChoice('sugary cereals')->setCheeseChoice('hard cheese')->setProteinChoice('ham')->setFruitAndVegChoice('0')->setPotatoesChoice('chips')->setDailySnackChoice('cake, biscuits, crisps, sweets')->setCompletedDate(new \DateTime());
$this->questionnaire->getSmoking()->setDoYouSmoke('yes')->setCompletedDate(new \DateTime());
$drinks = new Drinks();
$drinks->setBeerCiderPintAmount(5)->setWineAmount(3)->setSpiritsAmount(5)->setCompletedDate(new \DateTime());
$this->questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('mon, tue, wed, thur, fri, sat, sun')->setWeekendDrinks($drinks)->setWeekdayDrinks($drinks)->setCompletedDate(new \DateTime());
$this->questionnaire->getMoving()->setCompletedDate(new \DateTime());
}
示例7: testCompletedSectionsButNoQuestionnaireDate
public function testCompletedSectionsButNoQuestionnaireDate()
{
$this->instance->getDrinking()->setCompletedDate(new \DateTime());
$this->instance->getEating()->setCompletedDate(new \DateTime());
$this->instance->getMoving()->setCompletedDate(new \DateTime());
$this->instance->getSmoking()->setCompletedDate(new \DateTime());
$this->assertTrue($this->instance->isCompleted());
}
示例8: testICanGetAPositiveNarrativeAfterQuitting
public function testICanGetAPositiveNarrativeAfterQuitting()
{
$questionnaire = new Questionnaire(new Person());
$questionnaire->getAboutYou()->getFeelings()->setEnergy(100)->setMood(20);
$questionnaire->getSmoking()->setDoYouSmoke('quit')->setCompletedDate(new \DateTime());
$expected = array('smoking' => array('smoking_green_quit'));
$this->assertEquals($expected, $this->instance->buildNarrative($questionnaire)->getMessages());
}
示例9: extractSmokingScore
/**
* @param Questionnaire $questionnaire
*/
protected function extractSmokingScore(Questionnaire $questionnaire)
{
$doYouSmoke = $questionnaire->getSmoking()->getDoYouSmoke();
if ($doYouSmoke === 'yes' || $doYouSmoke === 'sometimes') {
$this->populateRag(self::RAG_RED, self::SCORE_RED);
} else {
$this->populateRag(self::RAG_GREEN, self::SCORE_GREEN);
}
}
示例10: testExtractSmoking
public function testExtractSmoking()
{
$expectedKeys = array("smokingDoYouSmoke", "smokingCompleted", "smokingRag");
$questionnaire = new Questionnaire(new Person());
$export = SmokingHelper::extractSmoking($questionnaire->getSmoking());
foreach ($expectedKeys as $key) {
$this->assertArrayHasKey($key, $export);
}
}
示例11: testAnyNonSmokerIsGreen
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']);
}
示例12: testICanGetANarrativeWithMaxFeeling
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));
}
}
示例13: testIGetANonEmptyResultsNarrativeOnACompleteQuiz
public function testIGetANonEmptyResultsNarrativeOnACompleteQuiz()
{
$person = (new Person())->setFirstName('test')->setGender('female');
$completedDate = new \DateTime();
$questionnaire = new Questionnaire($person);
$aboutYou = $questionnaire->getAboutYou();
$aboutYou->getFeelings()->setCompletedDate($completedDate);
$aboutYou->getHindrances()->setCompletedDate($completedDate);
$aboutYou->getMotivations()->setCompletedDate($completedDate);
$aboutYou->getDependants()->setCompletedDate($completedDate);
$questionnaire->setAboutYou($aboutYou->setCompletedDate($completedDate));
$questionnaire->getDrinking()->setCompletedDate($completedDate);
$questionnaire->getEating()->setCompletedDate($completedDate);
$questionnaire->getMoving()->setCompletedDate($completedDate);
$questionnaire->getSmoking()->setCompletedDate($completedDate);
$results = ResultsNarrativeHelper::extractResultsNarrative($questionnaire, $this->translator);
foreach ($results as $result) {
$this->assertEquals(base64_encode(self::TRANS_STRING), $result);
}
}
示例14: testSpecificationReturnsTrue
public function testSpecificationReturnsTrue()
{
$questionnaire = new Questionnaire(new Person());
$questionnaire->getSmoking()->setCompletedDate(new \DateTime());
$this->assertTrue($this->instance->isSatisfiedBy($questionnaire));
}
示例15: 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));
}