コード例 #1
0
 public function test__toString()
 {
     $this->tree->add(new Variant('child1'), 'default');
     $this->assertTrue(is_string($this->tree->__toString()));
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function buildVariantTree()
 {
     if ($this->lastTree) {
         return $this->lastTree;
     }
     $tree = new VariantTree();
     foreach ($this->variants as $name => $v) {
         //sets default values if any
         $mode = VariantInterface::MODE_INSTANT;
         if (isset($v['mode'])) {
             $mode = $v['mode'];
         }
         $process = array();
         if (isset($v['process'])) {
             $process = $v['process'];
         }
         $parent = NULL;
         if (isset($v['parent'])) {
             $parent = $v['parent'];
         }
         //creates the variant instance
         $variant = new Variant();
         $variant->setName($name);
         $variant->setMode($mode);
         $variant->setOptions($process);
         $tree->add($variant, $parent);
     }
     $this->lastTree = $tree;
     return $tree;
 }