コード例 #1
0
 public function testSetterAndGetter()
 {
     $live = new Live();
     $name = 'event name';
     $place = 'event place';
     $date = new \DateTime();
     $duration = '60';
     $display = 0;
     $create_serial = 0;
     $locale = 'en';
     $schedule = array('date' => $date, 'duration' => $duration);
     $pic = new Pic();
     $imagePath = '/path/to/image.jpg';
     $pic->setPath($imagePath);
     $event = new Event();
     $event->setLive($live);
     $event->setName($name);
     $event->setPlace($place);
     $event->setDate($date);
     $event->setDuration($duration);
     $event->setDisplay($display);
     $event->setCreateSerial($create_serial);
     $event->setPic($pic);
     $event->setLocale($locale);
     $event->setSchedule($schedule);
     $this->assertEquals($live, $event->getLive());
     $this->assertEquals($name, $event->getName());
     $this->assertEquals($place, $event->getPlace());
     $this->assertEquals($date, $event->getDate());
     $this->assertEquals($duration, $event->getDuration());
     $this->assertEquals($display, $event->getDisplay());
     $this->assertEquals($create_serial, $event->getCreateSerial());
     $this->assertEquals($locale, $event->getLocale());
     $this->assertEquals($pic, $event->getPic());
     $this->assertEquals($schedule, $event->getSchedule());
 }
コード例 #2
0
 private function createLiveEvent($live)
 {
     $event = new Event();
     $event->setLive($live);
     $event->setName('Live Event');
     $event->setDate(new \DateTime('now'));
     $event->setDuration(60);
     $event->setDisplay(true);
     $this->dm->persist($event);
     $this->dm->flush();
     return $event;
 }
コード例 #3
0
 public function testFindByHoursEvent()
 {
     $date = new \DateTime("15-12-2015 9:00:00");
     $date1 = new \DateTime("18-12-2015 9:00:00");
     $date2 = new \DateTime("30-12-2015 9:00:00");
     $date3 = new \DateTime("25-12-2015 9:00:00");
     $date4 = new \DateTime("15-12-2015 8:00:00");
     $date->setTime(9, 0, 0);
     $date1->setTime(9, 0, 0);
     $date2->setTime(9, 0, 0);
     $date3->setTime(9, 0, 0);
     $date4->setTime(9, 0, 0);
     $duration1 = 30;
     $duration2 = 60;
     $duration3 = 40;
     $duration4 = 120;
     $event1 = new Event();
     $event1->setDisplay(true);
     $event1->setDate($date1);
     $event1->setDuration($duration1);
     $event2 = new Event();
     $event2->setDisplay(true);
     $event2->setDate($date2);
     $event2->setDuration($duration2);
     $event3 = new Event();
     $event3->setDisplay(true);
     $event3->setDate($date3);
     $event3->setDuration($duration3);
     $event4 = new Event();
     $event4->setDisplay(true);
     $event4->setDate($date4);
     $event4->setDuration($duration4);
     $this->dm->persist($event1);
     $this->dm->persist($event2);
     $this->dm->persist($event3);
     $this->dm->persist($event4);
     $this->dm->flush();
     $this->assertEquals(null, $this->repo->findOneByHoursEvent(1));
     $this->assertEquals($event4, $this->repo->findOneByHoursEvent(3, $date));
 }