コード例 #1
0
 function it_should_be_added_new_information_field(NewInformationFieldListener $listener, AllInformationFields $allInformationFields)
 {
     $informationFieldId = new Uuid($this->faker->uuid);
     $request = new InformationFieldRequest(['name' => $this->faker->name]);
     $allInformationFields->add(Argument::type(InformationField::class))->shouldBeCalled();
     $allInformationFields->nextIdentity()->willReturn($informationFieldId);
     $this->attach($listener);
     $this->newInformationField($request);
     $listener->whenInformationFieldIsAdded(Argument::type(InformationFieldResponse::class))->shouldHaveBeenCalled();
 }
コード例 #2
0
 function it_should_be_added_new_question(NewQuestionListener $listener, AllInformationFields $allInformationFields, AllSections $allSections, AllQuestions $allQuestions)
 {
     $informationFieldId = $this->faker->uuid;
     $organizationId = $this->faker->uuid;
     $userId = $this->faker->uuid;
     $surveyId = $this->faker->uuid;
     $sectionId = $this->faker->uuid;
     $questionId = new Uuid($this->faker->uuid);
     $user = new User(new Uuid($userId), $this->faker->name, $this->faker->email);
     $organization = new Organization(new Uuid($organizationId), $this->faker->name, $user);
     $survey = new Survey(new Uuid($surveyId), $this->faker->title, $this->faker->text, $organization);
     $section = new Section(new Uuid($sectionId), $this->faker->title, $survey);
     $informationField = new InformationField(new Uuid($informationFieldId), $this->faker->name);
     $request = new questionRequest(['title' => $this->faker->title, 'weighing' => $this->faker->text, 'informationFieldId' => $informationField, 'sectionId' => $section]);
     $allInformationFields->informationFieldOfId($request->informationFieldId)->willReturn($informationField);
     $allSections->sectionOfId($request->sectionId)->willReturn($section);
     $allQuestions->add(Argument::type(Question::class))->shouldBeCalled();
     $allQuestions->nextIdentity()->willReturn($questionId);
     $this->attach($listener);
     $this->newQuestion($request);
     $listener->whenQuestionIsAdded(Argument::type(QuestionResponse::class))->shouldHaveBeenCalled();
 }
コード例 #3
0
 /**
  * @param InformationFieldRequest $request
  */
 public function newInformationField(InformationFieldRequest $request)
 {
     $informationField = new InformationField($this->allInformationFields->nextIdentity(), $request->name);
     $this->allInformationFields->add($informationField);
     $this->informationFieldListener->whenInformationFieldIsAdded(new InformationFieldResponse($informationField));
 }