public function testFindOneByShowSlug()
 {
     $ad = new TechieAdvert();
     $ad->setShow($this->show);
     $ad->setExpiry(new \DateTime('2014-03-12'));
     $ad->setDeadline(true);
     $ad->setDeadlineTime(new \DateTime('00:00'));
     $ad->setPositions("Technical Director\nLighting Designer");
     $ad->setContact('Contact me');
     $ad->setTechExtra('Get involved with this show');
     $this->em->persist($ad);
     $this->em->flush();
     $show = $this->getRepository()->findOneByShowSlug($this->show->getSlug(), new \DateTime('2014-03-01'));
     $this->assertInstanceOf('\\Acts\\CamdramBundle\\Entity\\TechieAdvert', $show);
 }
Exemplo n.º 2
0
 private function addTechieAdverts(ObjectManager $manager, Show $show)
 {
     $num_roles_to_seek = mt_rand(1, count($this->roles) - 1);
     $roles_to_seek = $this->roles;
     shuffle($roles_to_seek);
     $roles_to_seek = array_splice($roles_to_seek, 0, $num_roles_to_seek);
     $techieAdvert = new TechieAdvert();
     $techieAdvert->setPositions(implode("\n", $roles_to_seek));
     $techieAdvert->setContact('Random Contact ' . mt_rand(1, 100));
     $techieAdvert->setDeadline(false);
     $expiry = new \DateTime(mt_rand(-15, 60) . ' days');
     $techieAdvert->setExpiry($expiry);
     if (mt_rand(0, 4) > 0) {
         $techieAdvert->setDeadline(true);
         $hour = mt_rand(10, 22);
         $minute = mt_rand(0, 3) * 15;
         $deadline = $expiry->format("j M {$hour}:{$minute}");
         $techieAdvert->setDeadlineTime($expiry);
     }
     $techieAdvert->setDisplay(mt_rand(0, 4) > 0);
     $techExtra = '';
     if (mt_rand(0, 1) == 1) {
         $techExtra = 'Short Tech Extra';
     } elseif (mt_rand(0, 1) == 1) {
         $techExtra = "A very very long tech extra because some people don't know when to stop. You know the type," . 'they will go on and on about the show hoping to persuade you to do it because it is exciting with' . 'scaffolding and balloons and probably a raised forestage';
     }
     $techieAdvert->setTechExtra($techExtra);
     $techieAdvert->setShow($show);
     $manager->persist($techieAdvert);
 }