/**
  * @test
  * @author Robert Lemke <*****@*****.**>
  */
 public function allBasicOptionsAreSetCorrectly()
 {
     $factoryClassName = uniqid('ConfigurationBuilderTest');
     eval('class ' . $factoryClassName . ' { public function manufacture() {} } ');
     $configurationArray = array();
     $configurationArray['scope'] = 'prototype';
     $configurationArray['className'] = __CLASS__;
     $configurationArray['factoryClassName'] = $factoryClassName;
     $configurationArray['factoryMethodName'] = 'manufacture';
     $configurationArray['lifecycleInitializationMethodName'] = 'initializationMethod';
     $configurationArray['lifecycleShutdownMethodName'] = 'shutdownMethod';
     $configurationArray['autowiring'] = FALSE;
     $objectConfiguration = new \F3\FLOW3\Object\Configuration\Configuration('TestObject', __CLASS__);
     $objectConfiguration->setScope(\F3\FLOW3\Object\Configuration\Configuration::SCOPE_PROTOTYPE);
     $objectConfiguration->setClassName(__CLASS__);
     $objectConfiguration->setFactoryClassName($factoryClassName);
     $objectConfiguration->setFactoryMethodName('manufacture');
     $objectConfiguration->setLifecycleInitializationMethodName('initializationMethod');
     $objectConfiguration->setLifecycleShutdownMethodName('shutdownMethod');
     $objectConfiguration->setAutowiring(FALSE);
     $builtObjectConfiguration = \F3\FLOW3\Object\Configuration\ConfigurationBuilder::buildFromConfigurationArray('TestObject', $configurationArray, __CLASS__);
     $this->assertEquals($objectConfiguration, $builtObjectConfiguration, 'The manually created and the built object configuration don\'t match.');
 }
Ejemplo n.º 2
0
 /**
  * Register the given interface as an object type
  *
  * @param  string $objectName The name of the object type
  * @return void
  * @author Robert Lemke <*****@*****.**>
  * @api
  */
 public function registerObjectType($objectName)
 {
     $className = $this->reflectionService->getDefaultImplementationClassNameForInterface($objectName);
     $objectConfiguration = new \F3\FLOW3\Object\Configuration\Configuration($objectName);
     if ($className !== FALSE) {
         $objectConfiguration->setClassName($className);
         if ($this->reflectionService->isClassTaggedWith($className, 'scope')) {
             $scope = trim(implode('', $this->reflectionService->getClassTagValues($className, 'scope')));
             $objectConfiguration->setScope($scope);
         }
         $this->registeredClasses[$className] = $objectName;
     } else {
     }
     $this->registeredObjects[$objectName] = strtolower($objectName);
     $this->objectConfigurations[$objectName] = $objectConfiguration;
 }