Esempio n. 1
0
 /**
  * Warmer names validation.
  *
  * @param array $names       Names to check.
  * @param array $warmerNames Warmer names loaded.
  *
  * @throws \RuntimeException
  */
 private function validateWarmers($names, $warmerNames = [])
 {
     if (empty($warmerNames)) {
         $warmerNames = array_keys($this->warmers->getWarmers());
     }
     $unknown = array_diff($names, $warmerNames);
     if (!empty($unknown)) {
         throw new \RuntimeException('Warmer(s) named ' . implode(', ', $unknown) . ' do not exist. Available: ' . implode(', ', $warmerNames));
     }
 }
 /**
  * Tests if warmers container works as expected.
  */
 public function testWarmersContainer()
 {
     $container = new WarmersContainer();
     $container->setWarmers($this->getWarmers());
     $this->assertEquals(['warmer1' => [], 'warmer2' => []], $container->getWarmers());
 }