Exemplo n.º 1
0
 public function testResetPrizeAndAttendees()
 {
     $event = new Event('test');
     $event->setPrizes(array('Prize'));
     $event->setAttendees(array('Daniel'));
     $this->assertEquals(1, $event->getNumberOfPrizes());
     $this->assertEquals(1, $event->getNumberOfAttendees());
     $event->clearAttendees();
     $event->clearPrizes();
     $this->assertEquals(0, $event->getNumberOfPrizes());
     $this->assertEquals(0, $event->getNumberOfAttendees());
 }
 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dataHandler = $this->getApplication()->getContainer()->get('data_adapter');
     $this->event = $dataHandler->getEvent($input->getArgument('event_id'));
     $doLoadPrizes = true;
     if ($this->event->hasPrizes()) {
         $doLoadPrizes = $this->getHelper('dialog')->askConfirmation($output, 'The list of prizes for this event ID already exists, do you want to override? (no) ', false);
     }
     if ($doLoadPrizes) {
         $this->event->clearPrizes();
         $this->loadPrizes($input->getArgument('file'));
         $dataHandler->saveEvent($this->event);
         $output->writeln("<info>Loaded</info> <comment>{$this->event->getNumberOfPrizes()}</comment> <info>prizes.</info>");
     }
 }