Пример #1
0
 /**
  * Orchestrates the use-case of a speaker submitting a talk.
  *
  * @param TalkSubmission $submission
  *
  * @return Talk
  * @throws \Exception
  */
 public function submitTalk(TalkSubmission $submission)
 {
     if (!$this->callForProposal->isOpen()) {
         throw new \Exception('You cannot create talks once the call for papers has ended.');
     }
     $user = $this->identityProvider->getCurrentUser();
     // Create talk from submission.
     $talk = $submission->toTalk();
     // Own the talk to the speaker.
     $talk->user_id = $user->id;
     $this->talks->persist($talk);
     $this->dispatcher->dispatch('opencfp.talk.submit', new TalkWasSubmitted($talk));
     return $talk;
 }
Пример #2
0
 /** @test */
 public function it_should_say_cfp_is_closed_after_end_date_has_passed()
 {
     $cfp = new CallForProposal(new DateTime('-1 day'));
     $this->assertFalse($cfp->isOpen());
 }