Exemple #1
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')));
 }
 /**
  * {@inheritdoc}
  */
 public function import()
 {
     if ($this->findById(1)) {
         return;
     }
     $info = new RegistrationInfo();
     $info->setId(1);
     $info->setEvent($this->findEvent());
     $info->setStart(DateTime::createFromFormat('H:i:s', '00:00:00'));
     $info->setEnd(DateTime::createFromFormat('H:i:s', '23:59:59'));
     $info->setTalksPrice(60);
     $info->setWorkshopsPrice(40);
     $info->setCostVariation(25);
     $info->setStudentDiscount(50);
     $info->getEnd()->modify('+29 days');
     $this->forceAssignedIds($info);
     $this->manager->persist($info);
     $this->manager->flush();
 }