/**
  * Construct method
  *
  * @param GearmanCacheWrapper $gearmanCacheWrapper GearmanCacheWrapper
  * @param array               $defaultSettings     The default settings for the bundle
  */
 public function __construct(GearmanCacheWrapper $gearmanCacheWrapper, array $defaultSettings)
 {
     $this->workers = $gearmanCacheWrapper->getWorkers();
     if (isset($defaultSettings['job_prefix'])) {
         $this->jobPrefix = $defaultSettings['job_prefix'];
     }
 }
 /**
  * Executes the current command.
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  *
  * @return integer 0 if everything went fine, or an error code
  *
  * @throws \LogicException When this abstract class is not implemented
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$input->getOption('quiet')) {
         $kernelEnvironment = $this->kernel->getEnvironment();
         $output->writeln('Clearing the cache for the ' . $kernelEnvironment . ' environment');
     }
     $this->gearmanCacheWrapper->clear('');
 }
 /**
  * Set up method
  */
 public function setUp()
 {
     $this->command = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Command\\GearmanCacheWarmupCommand')->setMethods(null)->getMock();
     $this->input = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->output = $this->getMockBuilder('Symfony\\Component\\Console\\Output\\OutputInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->gearmanCacheWrapper = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Service\\GearmanCacheWrapper')->disableOriginalConstructor()->setMethods(array('warmup'))->getMock();
     $this->gearmanCacheWrapper->expects($this->once())->method('warmup');
     $this->kernel->expects($this->any())->method('getEnvironment')->will($this->returnValue('dev'));
     $this->command->setGearmanCacheWrapper($this->gearmanCacheWrapper)->setKernel($this->kernel);
 }