本文整理匯總了PHP中TransformCore\PHE\HayApi\PersistenceBundle\Entity\Questionnaire類的典型用法代碼示例。如果您正苦於以下問題:PHP Questionnaire類的具體用法?PHP Questionnaire怎麽用?PHP Questionnaire使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Questionnaire類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSpecificationIsTrue
public function testSpecificationIsTrue()
{
$questionnaire = new Questionnaire(new Person());
$drinks = $questionnaire->getDrinking()->getWeekdayDrinks()->setBeerCiderBottleAmount(1);
$questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('mon, tues')->setBingingFrequency(Drinking::BINGE_NEVER)->setWeekdayDrinks($drinks);
$this->assertTrue(DrinkingLTE2DaysLTE3UnitsSpecification::isSatisfiedBy($questionnaire));
}
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:DrinkingLTE2DaysLTE3UnitsSpecificationTest.php
示例2: testSpecificationIsTrue
public function testSpecificationIsTrue()
{
$questionnaire = new Questionnaire((new Person())->setGender(Person::GENDER_MALE));
$drinks = $questionnaire->getDrinking()->getWeekdayDrinks()->setBeerCiderBottleAmount(2);
$questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('mon, tues, wed, thur')->setBingingFrequency(Drinking::BINGE_NEVER)->setWeekdayDrinks($drinks);
$this->assertTrue(DrinkingBetween3And5DaysWithinSuggestedLimitsSpecification::isSatisfiedBy($questionnaire));
}
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:DrinkingBetween3And5DaysWithinSuggestedLimitsSpecificationTest.php
示例3: testSpecificationIsTrue
public function testSpecificationIsTrue()
{
$days = array('mon' => 80, 'tues' => 80);
$questionnaire = new Questionnaire(new Person());
$questionnaire->getMoving()->setAerobicActivityDays($days);
$this->assertTrue(AmberMovingAmberAerobicLowDaysRedStrengthSpecification::isSatisfiedBy($questionnaire));
}
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:AmberMovingAmberAerobicLowDaysRedStrengthSpecificationTest.php
示例4: testSpecificationIsFalse
public function testSpecificationIsFalse()
{
$questionnaire = new Questionnaire((new Person())->setGender(Person::GENDER_FEMALE));
$questionnaire->getDrinking()->setWhichDaysDoYouDrink('mon');
$questionnaire->getDrinking()->getWeekdayDrinks()->setSpiritsAmount(8);
$this->assertFalse(DrinkingDoesNotExceedDailyLimitsForGenderSpecification::isSatisfiedBy($questionnaire));
}
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:DrinkingDoesNotExceedDailyLimitsForGenderSpecificationTest.php
示例5: testSpecificationIsFalseAndIAmMale
public function testSpecificationIsFalseAndIAmMale()
{
$questionnaire = new Questionnaire((new Person())->setGender(Person::GENDER_MALE));
$drinks = (new Drinks())->setBeerCiderPintAmount(3);
$questionnaire->getDrinking()->setDoYouDrink(Drinking::DOES_DRINK)->setWhichDaysDoYouDrink('mon, tue, wed')->setWeekdayDrinks($drinks);
$this->assertFalse(DrinkingUnitsInLowerRiskForGenderSpecification::isSatisfiedBy($questionnaire));
}
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:DrinkingUnitsInLowerRiskForGenderSpecificationTest.php
示例6: testSpecificationIsTrue
public function testSpecificationIsTrue()
{
$questionnaire = new Questionnaire(new Person());
$questionnaire->getDrinking()->setWhichDaysDoYouDrink('sat, sun');
$questionnaire->getDrinking()->getWeekendDrinks()->setBeerCiderPintAmount(2);
$this->assertTrue(DrinkingExceedsThreeUnitsSpecification::isSatisfiedBy($questionnaire));
}
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:DrinkingExceedsThreeUnitsSpecificationTest.php
示例7: testCreateQuestionnaire
public function testCreateQuestionnaire()
{
$this->createQuestionnaire();
$this->assertNotNull($this->result);
$this->assertStringStartsWith('FIRST_NAME ', $this->result->getPerson()->getFirstName());
$this->assertNotEmpty($this->result->getId());
}
示例8: calculateScore
/**
* @inheritdoc
*/
public function calculateScore(Questionnaire $questionnaire)
{
if ($questionnaire->getMoving()->isCompleted()) {
$this->extractMovingScore($questionnaire);
}
return $this->getRag();
}
示例9: extractResultsNarrative
/**
* @param Questionnaire $questionnaire
* @param TranslatorInterface $translator
* @return array
*/
public static function extractResultsNarrative(Questionnaire $questionnaire, TranslatorInterface $translator)
{
if (true === $questionnaire->isCompleted()) {
self::prepareResultsNarrative($questionnaire, $translator);
}
return self::$resultsNarrative;
}
示例10: testSpecificationIsTrue
public function testSpecificationIsTrue()
{
$days = array('mon' => 30, 'tues' => 30, 'wed' => 30);
$questionnaire = new Questionnaire(new Person());
$questionnaire->getMoving()->setAerobicActivityDays($days);
$this->assertTrue(AerobicTimeLT150MinsDaysGTE3Specification::isSatisfiedBy($questionnaire));
}
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:7,代碼來源:AerobicTimeLT150MinsDaysGTE3SpecificationTest.php
示例11: addSignedInCompletedRecords
/**
* @param Questionnaire $questionnaire
* @param Document $document
*/
protected function addSignedInCompletedRecords(Questionnaire $questionnaire, Document &$document)
{
if (true === $questionnaire->isCompleted() && true === $questionnaire->getPerson()->isSignedUp()) {
$document->addRecord(new Record($questionnaire, $this->getContainer()->get('translator')));
}
$this->updateQuestionnaireAddressAndStatus($questionnaire);
}
示例12: 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());
}
示例13: testIGetARedMessageWithSnacksWarningEating
public function testIGetARedMessageWithSnacksWarningEating()
{
$questionnaire = new Questionnaire(new Person());
$questionnaire->getEating()->setProteinChoice('ham')->setCheeseChoice('hard cheese')->setPotatoesChoice('chips')->setDailySnackChoice('sweets, crisps, biscuits, cake')->setCompletedDate(new \DateTime());
$questionnaire->getAboutYou()->getFeelings()->setWeight(25);
$expected = array('eating' => array('eating_red', 'eating_red_low_weight'));
$this->assertEquals($expected, $this->instance->buildNarrative($questionnaire)->getMessages());
}
示例14: testIGetARedMessageWithFitnessQuestionForMoving
public function testIGetARedMessageWithFitnessQuestionForMoving()
{
$questionnaire = new Questionnaire(new Person());
$questionnaire->getMoving()->setCompletedDate(new \DateTime());
$questionnaire->getAboutYou()->getFeelings()->setFitness(21);
$expected = array('moving' => array('moving_red', 'moving_red_low_fitness'));
$this->assertEquals($expected, $this->instance->buildNarrative($questionnaire)->getMessages());
}
示例15: populateAddressDetailsFromPostCode
/**
* @param Questionnaire $questionnaire
* @return Questionnaire
*/
public function populateAddressDetailsFromPostCode(Questionnaire $questionnaire)
{
$address = $questionnaire->getPerson()->getAddress();
if ($this->hasPostCode($address) && $this->loadAuthorityForPostCode($address)) {
$questionnaire->getPerson()->setAddress($address);
}
return $questionnaire;
}