示例#1
0
 public function setUp()
 {
     $questions = array();
     for ($i = 0; $i < 4; $i++) {
         $question = new RiskQuestion();
         $question->setTitle('Question ' . ($i + 1));
         for ($j = 0; $j < 4; $j++) {
             $answer = new RiskAnswer();
             $answer->setTitle('Answer ' . ($i + 1) . ' - ' . ($j + 1));
             $answer->setQuestion($question);
             $answer->setPoint($j);
             $question->addAnswer($answer);
         }
         $questions[] = $question;
     }
     $userAnswers = array();
     foreach ($questions as $key => $question) {
         $userAnswer = new ClientQuestionnaireAnswer();
         $userAnswer->setQuestion($question);
         $questionAnswers = $question->getAnswers();
         $userAnswer->setAnswer($questionAnswers[$key]);
         $userAnswers[] = $userAnswer;
     }
     $portfolio = new CeModel();
     for ($i = 0; $i < 4; $i++) {
         $modelMock = $this->getMock('Wealthbot\\AdminBundle\\Entity\\CeModel', array('getId'));
         $modelMock->expects($this->any())->method('getId')->will($this->returnValue($i + 1));
         $modelMock->setName('Model ' . ($i + 1));
         $modelMock->setRiskRating($i + 1);
         $portfolio->addChildren($modelMock);
     }
     $riaCompanyInformation = new RiaCompanyInformation();
     $riaCompanyInformation->setPortfolioModel($portfolio);
     $ria = new User();
     $ria->setRoles(array('ROLE_RIA'));
     $ria->setRiaCompanyInformation($riaCompanyInformation);
     $userProfile = new Profile();
     $userProfile->setRia($ria);
     $user = new User();
     $user->setRoles(array('ROLE_CLIENT'));
     $user->setProfile($userProfile);
     $this->riskTolerance = new RiskTolerance($user, $userAnswers);
 }