/**
  * @expectedException \X\ConfigManager\Exception\EntityWrapperException
  * @expectedExceptionMessage Property with name duplicatingProperty already exists
  */
 public function testDuplicatingProperty()
 {
     $rootElementConfig = (include __DIR__ . '/../conf-example/root-element.php');
     $rootElementConfig['parentProperty'] = 'someProperty';
     $entityWrapper = new EntityWrapper($rootElementConfig);
     $entityWrapper->addProperty('duplicatingProperty', mt_rand());
     $entityWrapper->addProperty('duplicatingProperty', mt_rand());
 }
 /**
  * @param EntityWrapper $entity
  */
 private function triggerNewEntity(EntityWrapper $entity)
 {
     if ($entity->isRootEntity()) {
         $entityMapLink =& $this->rootEntities[$entity->getClassName()];
     } else {
         $entityMapLink =& $this->entities[$entity->getParentName()][$entity->getClassName()][$entity->getParentPropertyName()];
     }
     if (!$entity->isRootEntity() && array_key_exists($entity->getParentName(), $this->rootEntities)) {
         $this->rootEntities[$entity->getParentName()]['content'][] =& $entityMapLink;
     }
     if (array_key_exists($entity->getClassName(), $this->entities)) {
         foreach ($this->entities[$entity->getClassName()] as &$child) {
             foreach ($child as &$childProperty) {
                 $entityMapLink['content'][] =& $childProperty;
             }
             unset($childProperty);
         }
         unset($child);
     }
     if (!$this->rootEntities) {
         foreach ($this->entities as &$parentRootElement) {
             if (array_key_exists($entity->getParentName(), $parentRootElement)) {
                 foreach ($parentRootElement[$entity->getParentName()] as &$parent) {
                     $parent['content'][] =& $entityMapLink;
                 }
                 unset($parent);
             }
         }
         unset($parentRootElement);
     }
 }