/**
  * Tests the getData() method with a not existing key.
  *
  * @return void
  */
 public function testGetDataNotAvailable()
 {
     $this->assertNull($this->configuration->getData('foo'));
 }
예제 #2
0
 /**
  * Initialise from configuration instance
  *
  * @param \AppserverIo\Configuration\Interfaces\ConfigurationInterface $configuration The configuration instance
  *
  * @return void
  */
 public function initFromConfiguration(ConfigurationInterface $configuration)
 {
     // create a UUID and set the UUID of the parent node
     if ($configuration->getData('uuid') == null) {
         $this->setUuid($this->newUuid());
     } else {
         $this->setUuid($configuration->getData('uuid'));
     }
     // set the node name from the configuration
     $this->setNodeName($configuration->getNodeName());
     // invoke the preInit() method
     $this->preInit();
     // iterate over the PROTECTED properties and initialize them with the configuration data
     $reflectionObject = new \ReflectionObject($this);
     // ONLY use PROTECTED properties, NOT PRIVATE, else UUID's will be overwritten!!
     foreach ($reflectionObject->getProperties(\ReflectionProperty::IS_PROTECTED) as $reflectionProperty) {
         $this->getValueForReflectionProperty($reflectionProperty, $configuration);
     }
     // invoke the postInit() method
     $this->postInit();
 }