Пример #1
0
 public function testConfigOverrides()
 {
     $config = (require __DIR__ . '/data/beaucalquickunion.local.php');
     $options = new UnionOptions($config['beaucalquickunion']['union']);
     $this->assertEquals('adapter_class_another', $options->getAdapterClass());
     $this->assertEquals('order_class_another', $options->getOrderClass());
     $this->assertEquals('loop_damage_control_another', $options->getLoopDamageControl());
 }
Пример #2
0
 /**
  * @param string $item
  * @return mixed         String set identifier or null on blank input
  */
 protected function queryInternal($item)
 {
     $set = $item;
     /**
      * Follow the path and flatten as we go.
      * A loop -- which is VERY BAD -- will be detected.
      */
     for (;;) {
         $parent = $this->adapter->getParent($set);
         if ($parent == $set) {
             break;
         }
         /**
          * Loop found -- VERY BAD.  Can be bandaged up.
          */
         $grandparent = $this->adapter->getParent($parent);
         if ($grandparent == $set) {
             $alert = __CLASS__ . ": {$set} is its own grandparent";
             $this->getLogger() and $this->getLogger()->alert($alert);
             if (!$this->options->getLoopDamageControl()) {
                 throw new LoopException($alert);
             }
             $this->adapter->setParent($set, $set);
             break;
         }
         $this->adapter->setParent($set, $grandparent);
         $set = $grandparent;
     }
     return $set;
 }