예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function import()
 {
     if ($this->findById(1)) {
         return;
     }
     $event = new Event();
     $event->setId(1);
     $event->setLocation($this->findLocation());
     $event->setName('Evento de exemplo');
     $event->setStartDate(DateTime::createFromFormat('H:i:s', '00:00:00'));
     $event->setEndDate(DateTime::createFromFormat('H:i:s', '23:59:59'));
     $event->setSubmissionStart(DateTime::createFromFormat('H:i:s', '00:00:00'));
     $event->setSubmissionEnd(DateTime::createFromFormat('H:i:s', '23:59:59'));
     $event->getEndDate()->modify('+30 days');
     $event->getSubmissionEnd()->modify('+30 days');
     $this->forceAssignedIds($event);
     $this->manager->persist($event);
     $this->manager->flush();
 }
예제 #2
0
 /**
  * @test
  * @covers PHPSC\Conference\Domain\Entity\Event::__construct
  * @covers PHPSC\Conference\Domain\Entity\Event::setRegistrationInfo
  * @covers PHPSC\Conference\Domain\Entity\Event::getRegistrationInfo
  * @covers PHPSC\Conference\Domain\Entity\Event::hasAttendeeRegistration
  * @covers PHPSC\Conference\Domain\Entity\Event::isRegistrationPeriod
  * @covers PHPSC\Conference\Domain\Entity\Event::getEndDate
  * @covers PHPSC\Conference\Domain\Entity\Event::setEndDate
  * @covers PHPSC\Conference\Domain\Entity\Event::getStartDate
  * @covers PHPSC\Conference\Domain\Entity\Event::setStartDate
  * @covers PHPSC\Conference\Domain\Entity\Event::isEventPeriod
  * @covers PHPSC\Conference\Domain\Entity\Event::isRegularRegistrationPeriod
  */
 public function isRegularRegistrationPeriodShouldReturnFalseWhenIsNotRegistrationPeriod()
 {
     $event = new Event();
     $event->setRegistrationInfo($this->registrationInfo);
     $event->setStartDate(new DateTime('2014-08-29'));
     $event->setEndDate(new DateTime('2014-08-30'));
     $this->registrationInfo->expects($this->any())->method('getStart')->willReturn(new DateTime('2014-05-05 00:00:00'));
     $this->registrationInfo->expects($this->any())->method('getEnd')->willReturn(new DateTime('2014-08-30 14:00:00'));
     $this->assertFalse($event->isRegularRegistrationPeriod(new DateTime('2014-04-29 10:00:00')));
 }