/**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function initialiseWorker(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output)
 {
     $this->output = $output;
     $this->input = $input;
     $this->verbose = $input->getOption('verbose');
     $this->container = $this->getContainer();
     $this->logger = $this->container->get('logger');
     $this->consolePath = $this->container->get('kernel')->getRootDir() . '/../';
     $this->taskQueueService = $this->container->get('webdevvie_pheanstalktaskqueue.service');
     $this->tube = $this->input->getOption('use-tube');
     if (strlen($this->tube) == 0) {
         $this->tube = $this->taskQueueService->getDefaultTube();
     }
     //make sure signals are respected
     declare (ticks=1);
     pcntl_signal(SIGTERM, array($this, "sigTerm"));
     pcntl_signal(SIGINT, array($this, "sigInt"));
 }
 /**
  * tests the reserving of tasks if nothing is in the queue
  *
  * @return void
  */
 public function testReserveFilled()
 {
     $exampleTask = new ExampleTaskDescription();
     $taskId = 1;
     $this->setupExampleTaskInQueue($exampleTask, $taskId);
     $service = new TaskQueueService($this->entityManager, $this->pheanStalkProxy, $this->serializer, $this->params);
     $workPackage = $service->reserveTask();
     $this->assertInstanceOf('\\Webdevvie\\PheanstalkTaskQueueBundle\\Service\\DTO\\WorkPackage', $workPackage, 'Received class is not of class WorkPackage');
     $this->assertInstanceOf('\\Webdevvie\\PheanstalkTaskQueueBundle\\Command\\Example\\TaskDescription\\ExampleTaskDescription', $workPackage->getTaskDescription(), 'Received class is not of class ExampleTask');
     $this->assertInstanceOf('\\Webdevvie\\PheanstalkTaskQueueBundle\\Entity\\Task', $workPackage->getTaskEntity(), 'Received class is not of class Task');
 }